@@ -39,6 +39,7 @@ struct event
3939 pthread_cond_t cond ;
4040 bool event_triggered ;
4141};
42+ /*-----------------------------------------------------------*/
4243
4344struct event * event_create ( void )
4445{
@@ -48,13 +49,16 @@ struct event * event_create( void )
4849 {
4950 ev -> event_triggered = false;
5051 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
5255 pthread_mutex_init ( & ev -> mutex , & ev -> mutexattr );
5356 pthread_cond_init ( & ev -> cond , NULL );
5457 }
5558
5659 return ev ;
5760}
61+ /*-----------------------------------------------------------*/
5862
5963void event_delete ( struct event * ev )
6064{
@@ -63,13 +67,16 @@ void event_delete( struct event * ev )
6367 pthread_cond_destroy ( & ev -> cond );
6468 free ( ev );
6569}
70+ /*-----------------------------------------------------------*/
6671
6772bool event_wait ( struct event * ev )
6873{
6974 if ( pthread_mutex_lock ( & ev -> mutex ) == EOWNERDEAD )
7075 {
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
7380 }
7481
7582 while ( ev -> event_triggered == false )
@@ -81,6 +88,8 @@ bool event_wait( struct event * ev )
8188 pthread_mutex_unlock ( & ev -> mutex );
8289 return true;
8390}
91+ /*-----------------------------------------------------------*/
92+
8493bool event_wait_timed ( struct event * ev ,
8594 time_t ms )
8695{
@@ -92,8 +101,10 @@ bool event_wait_timed( struct event * ev,
92101 ts .tv_nsec += ( ( ms % 1000 ) * 1000000 );
93102 if ( pthread_mutex_lock ( & ev -> mutex ) == EOWNERDEAD )
94103 {
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
97108 }
98109
99110 while ( ( ev -> event_triggered == false ) && ( ret == 0 ) )
@@ -110,15 +121,19 @@ bool event_wait_timed( struct event * ev,
110121 pthread_mutex_unlock ( & ev -> mutex );
111122 return true;
112123}
124+ /*-----------------------------------------------------------*/
113125
114126void event_signal ( struct event * ev )
115127{
116128 if ( pthread_mutex_lock ( & ev -> mutex ) == EOWNERDEAD )
117129 {
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
120134 }
121135 ev -> event_triggered = true;
122136 pthread_cond_signal ( & ev -> cond );
123137 pthread_mutex_unlock ( & ev -> mutex );
124138}
139+ /*-----------------------------------------------------------*/
0 commit comments