Skip to content

Commit 38d4e66

Browse files
committed
---
yaml --- r: 8015 b: refs/heads/snap-stage3 c: 9c33f2c h: refs/heads/master i: 8013: e1862a5 8011: 0b418a9 8007: 1b34384 7999: 80cca77 v: v3
1 parent 772a404 commit 38d4e66

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: cd774fc5fab0791c3463ab192de9e0900904b460
4+
refs/heads/snap-stage3: 9c33f2c561c77567738ee949d0c39122daec063b
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/rt/sync/lock_and_signal.cpp

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,50 +68,17 @@ void lock_and_signal::unlock() {
6868
* Wait indefinitely until condition is signaled.
6969
*/
7070
void lock_and_signal::wait() {
71-
timed_wait(0);
72-
}
73-
74-
bool lock_and_signal::timed_wait(size_t timeout_in_ms) {
7571
assert(lock_held_by_current_thread());
7672
_holding_thread = INVALID_THREAD;
77-
bool rv = true;
7873
#if defined(__WIN32__)
7974
LeaveCriticalSection(&_cs);
80-
DWORD timeout = timeout_in_ms == 0 ? INFINITE : timeout_in_ms;
81-
rv = WaitForSingleObject(_event, timeout) != WAIT_TIMEOUT;
75+
WaitForSingleObject(_event, INFINITE);
8276
EnterCriticalSection(&_cs);
8377
_holding_thread = GetCurrentThreadId();
8478
#else
85-
if (timeout_in_ms == 0) {
86-
CHECKED(pthread_cond_wait(&_cond, &_mutex));
87-
} else {
88-
timeval time_val;
89-
gettimeofday(&time_val, NULL);
90-
timespec time_spec;
91-
time_spec.tv_sec = time_val.tv_sec + 0;
92-
time_spec.tv_nsec = time_val.tv_usec * 1000 + timeout_in_ms * 1000000;
93-
if(time_spec.tv_nsec >= 1000000000) {
94-
time_spec.tv_sec++;
95-
time_spec.tv_nsec -= 1000000000;
96-
}
97-
int cond_wait_status
98-
= pthread_cond_timedwait(&_cond, &_mutex, &time_spec);
99-
switch(cond_wait_status) {
100-
case 0:
101-
// successfully grabbed the lock.
102-
break;
103-
case ETIMEDOUT:
104-
// Oops, we timed out.
105-
rv = false;
106-
break;
107-
default:
108-
// Error
109-
CHECKED(cond_wait_status);
110-
}
111-
}
79+
CHECKED(pthread_cond_wait(&_cond, &_mutex));
11280
_holding_thread = pthread_self();
11381
#endif
114-
return rv;
11582
}
11683

11784
/**

branches/snap-stage3/src/rt/sync/lock_and_signal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class lock_and_signal {
2121
void lock();
2222
void unlock();
2323
void wait();
24-
bool timed_wait(size_t timeout_in_ns);
2524
void signal();
2625
void signal_all();
2726

0 commit comments

Comments
 (0)