- read(watcher->fd, buf, 1);
- switch (buf[0]) {
- case '+':
- citthread_mutex_lock(&EventQueueMutex);
-
- if (InboundEventQueues[0] == InboundEventQueue) {
- InboundEventQueue = InboundEventQueues[1];
- q = InboundEventQueues[0];
- }
- else {
- InboundEventQueue = InboundEventQueues[0];
- q = InboundEventQueues[1];
- }
- citthread_mutex_unlock(&EventQueueMutex);
-
- It = GetNewHashPos(q, 0);
- while (GetNextHashPos(q, It, &len, &Key, &v))
- {
- IOAddHandler *h = v;
- h->EvAttch(h->IO);
- }
- DeleteHashPos(&It);
- DeleteHashContent(&q);
-/// TODO: add it to QueueEvents
- break;
- case 'x':
- close(event_add_pipe[0]);
-/// TODO; flush QueueEvents fd's and delete it.
- ev_io_stop(event_base, &queue_add_event);
- ev_unloop(event_base, EVUNLOOP_ALL);
+ citthread_mutex_lock(&EventQueueMutex);
+
+ if (InboundEventQueues[0] == InboundEventQueue) {
+ InboundEventQueue = InboundEventQueues[1];
+ q = InboundEventQueues[0];
+ }
+ else {
+ InboundEventQueue = InboundEventQueues[0];
+ q = InboundEventQueues[1];
+ }
+ citthread_mutex_unlock(&EventQueueMutex);
+
+ It = GetNewHashPos(q, 0);
+ while (GetNextHashPos(q, It, &len, &Key, &v))
+ {
+ IOAddHandler *h = v;
+ h->EvAttch(h->IO);