This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <queue> | |
#include <mutex> | |
#include <memory> | |
#include <condition_variable> | |
#include <stdio.h> | |
#include <iostream> | |
/* | |
* thread safe && exception safe queue implementation. | |
* Save item in shared_ptr in the queue to make sure all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <queue> | |
#include <mutex> | |
#include <memory> | |
#include <condition_variable> | |
#include <stdio.h> | |
#include <iostream> | |
/* | |
* thread safe queue implementation. | |
* Use a mutex and condition_variable to keep thread safe. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <stack> | |
#include <vector> | |
#include <string> | |
#include <exception> | |
#include <mutex> | |
#include <thread> | |
#include <condition_variable> | |
#include <queue> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mutex> | |
#include <memory> | |
#include <stdio.h> | |
#include <condition_variable> | |
#define DEBUG1 | |
template <class T> | |
class threadsafe_subtle_queue | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <atomic> | |
/* | |
* | |
* spin lock implemented by C++ std::atomic | |
* | |
*/ | |
class spinlock_mutex | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "join_threads.h" | |
#include "threadsafe_subtle_queue.cpp" | |
#include "threadsafe_exceptionsafe_queue.cpp" | |
#include <thread> | |
#include <vector> | |
#include <atomic> | |
/* | |
* Simplest thread pool implementation, exception safe. | |
* Don't support user wait all task finish. |