Showing
1 changed file
with
4 additions
and
1 deletions
@@ -102,17 +102,18 @@ TR_commManagerSelect(void * _this, TR_Event event) | @@ -102,17 +102,18 @@ TR_commManagerSelect(void * _this, TR_Event event) | ||
102 | if (! this->io_triggered) { | 102 | if (! this->io_triggered) { |
103 | printf("[DEBUG] [%s] io triggerd was empty\n", buffer); | 103 | printf("[DEBUG] [%s] io triggerd was empty\n", buffer); |
104 | fflush(stdout); | 104 | fflush(stdout); |
105 | + | ||
105 | pthread_mutex_lock(&this->io_triggered_lock); | 106 | pthread_mutex_lock(&this->io_triggered_lock); |
106 | this->io_triggered = TR_hashEach(this->write, this, commManagerIssueWriteEvents); | 107 | this->io_triggered = TR_hashEach(this->write, this, commManagerIssueWriteEvents); |
107 | this->io_triggered += TR_hashEach(this->accept, this, commManagerIssueAcceptEvents); | 108 | this->io_triggered += TR_hashEach(this->accept, this, commManagerIssueAcceptEvents); |
108 | this->io_triggered += TR_hashEach(this->read, this, commManagerIssueReadEvents); | 109 | this->io_triggered += TR_hashEach(this->read, this, commManagerIssueReadEvents); |
109 | - pthread_mutex_unlock(&this->io_triggered_lock); | ||
110 | } | 110 | } |
111 | 111 | ||
112 | printf("[DEBUG] [%s] io triggerd: %lu\n", buffer, this->io_triggered); | 112 | printf("[DEBUG] [%s] io triggerd: %lu\n", buffer, this->io_triggered); |
113 | fflush(stdout); | 113 | fflush(stdout); |
114 | 114 | ||
115 | if (! this->io_triggered) { | 115 | if (! this->io_triggered) { |
116 | + pthread_mutex_unlock(&this->io_triggered_lock); | ||
116 | if (NULL == timer) { | 117 | if (NULL == timer) { |
117 | timeout = TR_eventDispatcherGetDataWaitTime(dispatcher); | 118 | timeout = TR_eventDispatcherGetDataWaitTime(dispatcher); |
118 | } else { | 119 | } else { |
@@ -123,6 +124,8 @@ TR_commManagerSelect(void * _this, TR_Event event) | @@ -123,6 +124,8 @@ TR_commManagerSelect(void * _this, TR_Event event) | ||
123 | fflush(stdout); | 124 | fflush(stdout); |
124 | 125 | ||
125 | TR_CALL(_this, TR_CommManager, select, event, timeout); | 126 | TR_CALL(_this, TR_CommManager, select, event, timeout); |
127 | + } else { | ||
128 | + pthread_mutex_unlock(&this->io_triggered_lock); | ||
126 | } | 129 | } |
127 | 130 | ||
128 | return TR_EVENT_DONE; | 131 | return TR_EVENT_DONE; |
Please
register
or
login
to post a comment