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