71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{
int error;
DWORD status;
if ((error = OFPlainMutexUnlock(mutex)) != 0)
return error;
of_atomic_int_inc(&condition->count);
status = WaitForSingleObject(condition->event, INFINITE);
of_atomic_int_dec(&condition->count);
switch (status) {
case WAIT_OBJECT_0:
return OFPlainMutexLock(mutex);
case WAIT_FAILED:
switch (GetLastError()) {
case ERROR_INVALID_HANDLE:
|
|
|
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{
int error;
DWORD status;
if ((error = OFPlainMutexUnlock(mutex)) != 0)
return error;
OFAtomicIntIncrease(&condition->count);
status = WaitForSingleObject(condition->event, INFINITE);
OFAtomicIntDecrease(&condition->count);
switch (status) {
case WAIT_OBJECT_0:
return OFPlainMutexLock(mutex);
case WAIT_FAILED:
switch (GetLastError()) {
case ERROR_INVALID_HANDLE:
|
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
{
int error;
DWORD status;
if ((error = OFPlainMutexUnlock(mutex)) != 0)
return error;
of_atomic_int_inc(&condition->count);
status = WaitForSingleObject(condition->event, timeout * 1000);
of_atomic_int_dec(&condition->count);
switch (status) {
case WAIT_OBJECT_0:
return OFPlainMutexLock(mutex);
case WAIT_TIMEOUT:
return ETIMEDOUT;
case WAIT_FAILED:
|
|
|
|
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
{
int error;
DWORD status;
if ((error = OFPlainMutexUnlock(mutex)) != 0)
return error;
OFAtomicIntIncrease(&condition->count);
status = WaitForSingleObject(condition->event, timeout * 1000);
OFAtomicIntDecrease(&condition->count);
switch (status) {
case WAIT_OBJECT_0:
return OFPlainMutexLock(mutex);
case WAIT_TIMEOUT:
return ETIMEDOUT;
case WAIT_FAILED:
|