OLD | NEW |
1 #include <threads.h> | 1 #include <threads.h> |
2 #include <errno.h> | 2 #include <errno.h> |
3 | 3 |
4 int __pthread_cond_timedwait(cnd_t *restrict, mtx_t *restrict, const struct time
spec *restrict); | 4 int __pthread_cond_timedwait(cnd_t* restrict, |
| 5 mtx_t* restrict, |
| 6 const struct timespec* restrict); |
5 | 7 |
6 int cnd_timedwait(cnd_t *restrict c, mtx_t *restrict m, const struct timespec *r
estrict ts) | 8 int cnd_timedwait(cnd_t* restrict c, |
7 { | 9 mtx_t* restrict m, |
8 » int ret = __pthread_cond_timedwait(c, m, ts); | 10 const struct timespec* restrict ts) { |
9 » switch (ret) { | 11 int ret = __pthread_cond_timedwait(c, m, ts); |
10 » /* May also return EINVAL or EPERM. */ | 12 switch (ret) { |
11 » default: return thrd_error; | 13 /* May also return EINVAL or EPERM. */ |
12 » case 0: return thrd_success; | 14 default: |
13 » case ETIMEDOUT: return thrd_timedout; | 15 return thrd_error; |
14 » } | 16 case 0: |
| 17 return thrd_success; |
| 18 case ETIMEDOUT: |
| 19 return thrd_timedout; |
| 20 } |
15 } | 21 } |
OLD | NEW |