ObjFW  Diff

Differences From Artifact [59d3a90643]:

To Artifact [d7af2c3e9e]:


15
16
17
18
19
20
21
22

23
24
25
26
27
28

29
30
31
32
33
34

35
36
37
38
39
40

41
42
43
44
45
46

47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
 * file.
 */

#include "config.h"

#import "condition.h"

bool

of_condition_new(of_condition_t *condition)
{
	return (pthread_cond_init(condition, NULL) == 0);
}

bool

of_condition_signal(of_condition_t *condition)
{
	return (pthread_cond_signal(condition) == 0);
}

bool

of_condition_broadcast(of_condition_t *condition)
{
	return (pthread_cond_broadcast(condition) == 0);
}

bool

of_condition_wait(of_condition_t *condition, of_mutex_t *mutex)
{
	return (pthread_cond_wait(condition, mutex) == 0);
}

bool

of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex,
    of_time_interval_t timeout)
{
	struct timespec ts;

	ts.tv_sec = (time_t)timeout;
	ts.tv_nsec = (long)((timeout - ts.tv_sec) * 1000000000);

	return (pthread_cond_timedwait(condition, mutex, &ts) == 0);
}

bool

of_condition_free(of_condition_t *condition)
{
	return (pthread_cond_destroy(condition) == 0);
}







<
>


|


<
>


|


<
>


|


<
>


|


<
>








|


<
>


|

15
16
17
18
19
20
21

22
23
24
25
26
27

28
29
30
31
32
33

34
35
36
37
38
39

40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
 * file.
 */

#include "config.h"

#import "condition.h"


int
of_condition_new(of_condition_t *condition)
{
	return pthread_cond_init(condition, NULL);
}


int
of_condition_signal(of_condition_t *condition)
{
	return pthread_cond_signal(condition);
}


int
of_condition_broadcast(of_condition_t *condition)
{
	return pthread_cond_broadcast(condition);
}


int
of_condition_wait(of_condition_t *condition, of_mutex_t *mutex)
{
	return pthread_cond_wait(condition, mutex);
}


int
of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex,
    of_time_interval_t timeout)
{
	struct timespec ts;

	ts.tv_sec = (time_t)timeout;
	ts.tv_nsec = (long)((timeout - ts.tv_sec) * 1000000000);

	return pthread_cond_timedwait(condition, mutex, &ts);
}


int
of_condition_free(of_condition_t *condition)
{
	return pthread_cond_destroy(condition);
}