- pthread_attr_t attribs;
- pthread_attr_init(&attribs);
- pthread_attr_setdetachstate(&attribs, PTHREAD_CREATE_JOINABLE);
- pthread_t* MyPThread = new pthread_t;
-
- /* Create a thread in a mutex. This prevents whacking the member value NewThread,
- * and also prevents recursive creation of threads by mistake (instead, the thread
- * will just deadlock itself)
- */
- Mutex(true);
-
- if (pthread_create(MyPThread, &attribs, PThreadEngine::Entry, (void*)this) != 0)
+ thread->SetExitFlag();
+ pthread_join(thread->state.pthread_id, NULL);
+}
+
+#ifdef HAS_EVENTFD
+#include <sys/eventfd.h>
+
+class ThreadSignalSocket : public EventHandler
+{
+ SocketThread* parent;
+ public:
+ ThreadSignalSocket(SocketThread* p, int newfd) : parent(p)