7 #ifndef CLIB_THREADHELP_H 8 #define CLIB_THREADHELP_H 11 #include <boost/noncopyable.hpp> 32 void run_thread(
void ( *threadf )(
void* ),
void* arg );
34 void start_thread(
void ( *entry )(
void* ),
const char* thread_name,
void* arg );
35 void start_thread(
void ( *entry )(
void ),
const char* thread_name );
43 typedef std::map<size_t, std::string>
Contents;
45 typedef std::map<size_t, HANDLE> HANDLES;
46 HANDLE getThreadHandle(
size_t pid )
const;
63 void SetThreadName(
int dwThreadID, std::string threadName );
76 typedef std::function<void()>
msg;
84 void push(
const msg& msg );
85 std::future<bool> checked_push(
const msg& msg );
88 void init_pool(
unsigned int max_count,
const std::string&
name );
92 void init(
unsigned int max_count,
const std::string&
name );
103 typedef std::function<void()>
msg;
109 void push(
const msg& msg );
110 std::future<bool> checked_push(
const msg& msg );
111 size_t threadpoolsize()
const;
127 #endif // CLIB_THREADHELP_H
std::vector< std::unique_ptr< PoolWorker > > _threads
void create_thread(ThreadData *td, bool dec_child=false)
void start_thread(void(*entry)(void *), const char *thread_name, void *arg)
Clib::message_queue< msg > msg_queue
Clib::message_queue< msg > msg_queue
std::function< void()> msg
void Unregister(size_t pid)
void CopyContents(Contents &out) const
std::atomic< bool > _done
void run_thread(void(*threadf)(void))
std::atomic< unsigned int > child_threads
std::map< size_t, std::string > Contents
void thread_sleep_ms(unsigned millis)
std::atomic< bool > _done
std::function< void()> msg
void Register(size_t pid, const std::string &name)
std::vector< std::thread > _threads