summaryrefslogtreecommitdiff
path: root/src/threads/cnd_timedwait.c
blob: ebd822f064ad5c44676c14f82d5d0cffc2b539ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <threads.h>
#include <pthread.h>
#include <errno.h>

int cnd_timedwait(cnd_t *restrict cond, mtx_t *restrict mtx, const struct timespec *restrict ts)
{
	switch (pthread_cond_timedwait(cond, mtx, ts)) {
	case 0:
		return thrd_success;

	case ETIMEDOUT:
		return thrd_timedout;

	default:
		break;
	}

	return thrd_error;
}

/*
STDC(201112)
*/