+ void Notify()
+ {
+ static const char dummy = '*';
+ write(send_fd, &dummy, 1);
+ }
+
+ void OnEventHandlerRead() CXX11_OVERRIDE
+ {
+ char dummy[128];
+ read(fd, dummy, 128);
+ parent->OnNotify();
+ }
+
+ void OnEventHandlerWrite() CXX11_OVERRIDE
+ {
+ ServerInstance->GlobalCulls.AddItem(this);
+ }
+
+ void OnEventHandlerError(int errcode) CXX11_OVERRIDE
+ {
+ ThreadSignalSocket::OnEventHandlerWrite();
+ }
+};
+
+SocketThread::SocketThread()
+{
+ signal.sock = NULL;
+ int fds[2];
+ if (pipe(fds))
+ throw CoreException("Could not create pipe " + std::string(strerror(errno)));
+ signal.sock = new ThreadSignalSocket(this, fds[0], fds[1]);