Overview
Comment: | Improve of_condition_wait error handling on Win32 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d07ed3f5df92571ed3f0503ffe38e612 |
User & Date: | js on 2016-04-18 16:02:09 |
Other Links: | manifest | tags |
Context
2016-04-18
| ||
17:00 | OFThread: Fix missing include check-in: e630807216 user: js tags: trunk | |
16:02 | Improve of_condition_wait error handling on Win32 check-in: d07ed3f5df user: js tags: trunk | |
14:08 | Further clean up of the threading.m split check-in: 9babc44b91 user: js tags: trunk | |
Changes
Modified src/threading_winapi.m from [f68816b3a0] to [7b696c0768].
︙ | ︙ | |||
199 200 201 202 203 204 205 206 207 208 209 | return true; } bool of_condition_wait(of_condition_t *condition, of_mutex_t *mutex) { if (!of_mutex_unlock(mutex)) return false; of_atomic_int_inc(&condition->count); | > > < | < < < < | > > < | < < < < < | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | return true; } bool of_condition_wait(of_condition_t *condition, of_mutex_t *mutex) { DWORD status; if (!of_mutex_unlock(mutex)) return false; of_atomic_int_inc(&condition->count); status = WaitForSingleObject(condition->event, INFINITE); of_atomic_int_dec(&condition->count); if (!of_mutex_lock(mutex)) return false; return (status == WAIT_OBJECT_0); } bool of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex, of_time_interval_t timeout) { DWORD status; if (!of_mutex_unlock(mutex)) return false; of_atomic_int_inc(&condition->count); status = WaitForSingleObject(condition->event, timeout * 1000); of_atomic_int_dec(&condition->count); if (!of_mutex_lock(mutex)) return false; return (status == WAIT_OBJECT_0); } bool of_condition_free(of_condition_t *condition) { if (condition->count != 0) return false; return CloseHandle(condition->event); } |