Mercurial > pub > ImplabNet
comparison Implab/AbstractEvent.cs @ 148:e6d4b41f0101 v2
fixed timeout handling in promises
author | cin |
---|---|
date | Wed, 15 Apr 2015 07:30:20 +0300 |
parents | 706fccb85524 |
children | 97fbbf816844 |
comparison
equal
deleted
inserted
replaced
147:25cdef49102f | 148:e6d4b41f0101 |
---|---|
170 | 170 |
171 protected abstract Signal GetResolveSignal(); | 171 protected abstract Signal GetResolveSignal(); |
172 | 172 |
173 #region synchronization traits | 173 #region synchronization traits |
174 protected void WaitResult(int timeout) { | 174 protected void WaitResult(int timeout) { |
175 if (!IsResolved) | 175 if (!(IsResolved || GetResolveSignal().Wait(timeout))) |
176 GetResolveSignal().Wait(timeout); | 176 throw new TimeoutException(); |
177 | 177 |
178 switch (m_state) { | 178 switch (m_state) { |
179 case SUCCEEDED_STATE: | 179 case SUCCEEDED_STATE: |
180 return; | 180 return; |
181 case CANCELLED_STATE: | 181 case CANCELLED_STATE: |