43 sLog.Blue(
" Threading",
"Threading System Initialized.");
65 else if (status == -1) {
66 _log(THREAD__ERROR,
"Process() - select() returned: %s", strerror(status));
90 int status = pthread_create( &thread,
nullptr, start_routine, args);
92 _log(THREAD__ERROR,
"CreateThread() - Error Creating new thread: %s", strerror(errno));
94 _log(THREAD__INFO,
"CreateThread() - Creating new threadID 0x%X", thread);
96 pthread_detach(thread);
102 _log(THREAD__INFO,
"AddThread() - Added thread ID 0x%X", thread);
106 for (std::vector<pthread_t>::iterator cur =
m_threads.begin(); cur !=
m_threads.end(); ++cur) {
107 if ((*cur) == thread) {
108 _log(THREAD__INFO,
"RemoveThread() called for thread ID 0x%X", thread);
113 _log(THREAD__ERROR,
"RemoveThread() - Called on unregistered threadID 0x%X", thread);
118 sLog.Warning(
" ",
"ThreadID 0x%X", cur );
123 _log(THREAD__MESSAGE,
"EndThreads() - There are no active threads.");
126 _log(THREAD__MESSAGE,
"EndThreads() - Joining %u currently active threads.",
m_threads.size());
127 std::vector<pthread_t>::iterator cur =
m_threads.begin();
129 _log(THREAD__TRACE,
"EndThreads() - Removing threadID 0x%X", (*cur));
#define _log(type, fmt,...)
std::vector< pthread_t > m_threads
#define sLog
Evaluates to a NewLog instance.
void RemoveThread(pthread_t thread)
void CreateThread(void *(*start_routine)(void *), void *args)
void AddThread(pthread_t thread)
void AddSocket(SOCKET soc)