summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/thread/pthread_condattr_setclock.c
blob: 21ca070c3ecde0e9c3e44cea86fab3096ce6b651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "pthread_impl.h"

#ifndef __wasilibc_unmodified_upstream
#include <common/clock.h>
#endif

int pthread_condattr_setclock(pthread_condattr_t *a, clockid_t clk)
{
#ifdef __wasilibc_unmodified_upstream
	if (clk < 0 || clk-2U < 2) return EINVAL;
#else
	if (clk->id < 0 || clk->id-2U < 2) return EINVAL;
#endif
	a->__attr &= 0x80000000;
#ifdef __wasilibc_unmodified_upstream
	a->__attr |= clk;
#else
	a->__attr |= clk->id;
#endif
	return 0;
}