@@ -39,6 +39,7 @@ struct event
39
39
pthread_cond_t cond ;
40
40
bool event_triggered ;
41
41
};
42
+ /*-----------------------------------------------------------*/
42
43
43
44
struct event * event_create ( void )
44
45
{
@@ -48,13 +49,16 @@ struct event * event_create( void )
48
49
{
49
50
ev -> event_triggered = false;
50
51
pthread_mutexattr_init ( & ev -> mutexattr );
51
- pthread_mutexattr_setrobust ( & ev -> mutexattr , PTHREAD_MUTEX_ROBUST );
52
+ #ifndef __APPLE__
53
+ pthread_mutexattr_setrobust ( & ev -> mutexattr , PTHREAD_MUTEX_ROBUST );
54
+ #endif
52
55
pthread_mutex_init ( & ev -> mutex , & ev -> mutexattr );
53
56
pthread_cond_init ( & ev -> cond , NULL );
54
57
}
55
58
56
59
return ev ;
57
60
}
61
+ /*-----------------------------------------------------------*/
58
62
59
63
void event_delete ( struct event * ev )
60
64
{
@@ -63,13 +67,16 @@ void event_delete( struct event * ev )
63
67
pthread_cond_destroy ( & ev -> cond );
64
68
free ( ev );
65
69
}
70
+ /*-----------------------------------------------------------*/
66
71
67
72
bool event_wait ( struct event * ev )
68
73
{
69
74
if ( pthread_mutex_lock ( & ev -> mutex ) == EOWNERDEAD )
70
75
{
71
- /* If the thread owning the mutex died, make the mutex consistent. */
72
- pthread_mutex_consistent ( & ev -> mutex );
76
+ #ifndef __APPLE__
77
+ /* If the thread owning the mutex died, make the mutex consistent. */
78
+ pthread_mutex_consistent ( & ev -> mutex );
79
+ #endif
73
80
}
74
81
75
82
while ( ev -> event_triggered == false )
@@ -81,6 +88,8 @@ bool event_wait( struct event * ev )
81
88
pthread_mutex_unlock ( & ev -> mutex );
82
89
return true;
83
90
}
91
+ /*-----------------------------------------------------------*/
92
+
84
93
bool event_wait_timed ( struct event * ev ,
85
94
time_t ms )
86
95
{
@@ -92,8 +101,10 @@ bool event_wait_timed( struct event * ev,
92
101
ts .tv_nsec += ( ( ms % 1000 ) * 1000000 );
93
102
if ( pthread_mutex_lock ( & ev -> mutex ) == EOWNERDEAD )
94
103
{
95
- /* If the thread owning the mutex died, make the mutex consistent. */
96
- pthread_mutex_consistent ( & ev -> mutex );
104
+ #ifndef __APPLE__
105
+ /* If the thread owning the mutex died, make the mutex consistent. */
106
+ pthread_mutex_consistent ( & ev -> mutex );
107
+ #endif
97
108
}
98
109
99
110
while ( ( ev -> event_triggered == false ) && ( ret == 0 ) )
@@ -110,15 +121,19 @@ bool event_wait_timed( struct event * ev,
110
121
pthread_mutex_unlock ( & ev -> mutex );
111
122
return true;
112
123
}
124
+ /*-----------------------------------------------------------*/
113
125
114
126
void event_signal ( struct event * ev )
115
127
{
116
128
if ( pthread_mutex_lock ( & ev -> mutex ) == EOWNERDEAD )
117
129
{
118
- /* If the thread owning the mutex died, make the mutex consistent. */
119
- pthread_mutex_consistent ( & ev -> mutex );
130
+ #ifndef __APPLE__
131
+ /* If the thread owning the mutex died, make the mutex consistent. */
132
+ pthread_mutex_consistent ( & ev -> mutex );
133
+ #endif
120
134
}
121
135
ev -> event_triggered = true;
122
136
pthread_cond_signal ( & ev -> cond );
123
137
pthread_mutex_unlock ( & ev -> mutex );
124
138
}
139
+ /*-----------------------------------------------------------*/
0 commit comments