// sleep this thread, waiting for condition signal #ifdefined( HAVE_POSIX_THREAD ) #define Condition_Wait( Cond ) pthread_cond_wait( &(Cond)->mCondition, &(Cond)->mMutex ) #elifdefined( HAVE_WIN32_THREAD ) // atomically release mutex and wait on condition, // then re-acquire the mutex #define Condition_Wait( Cond ) do { \
SignalObjectAndWait( (Cond)->mMutex, (Cond)->mCondition, INFINITE, false ); \
Mutex_Lock( &(Cond)->mMutex ); \
} while ( 0 ) #else #define Condition_Wait( Cond ) #endif
// sleep this thread, waiting for condition signal, // but bound sleep time by the relative time inSeconds. #ifdefined( HAVE_POSIX_THREAD ) #define Condition_TimedWait( Cond, inSeconds ) do { \ struct timespec absTimeout; \
absTimeout.tv_sec = time( NULL ) + inSeconds; \
absTimeout.tv_nsec = 0; \
pthread_cond_timedwait( &(Cond)->mCondition, &(Cond)->mMutex, &absTimeout ); \
} while ( 0 ) #elifdefined( HAVE_WIN32_THREAD ) // atomically release mutex and wait on condition, // then re-acquire the mutex #define Condition_TimedWait( Cond, inSeconds ) do { \
SignalObjectAndWait( (Cond)->mMutex, (Cond)->mCondition, inSeconds*1000, false ); \
Mutex_Lock( &(Cond)->mMutex ); \
} while ( 0 ) #else #define Condition_TimedWait( Cond, inSeconds ) #endif
// send a condition signal to wake one thread waiting on condition // in Win32, this actually wakes up all threads, same as Broadcast // use PulseEvent to auto-reset the signal after waking all threads #ifdefined( HAVE_POSIX_THREAD ) #define Condition_Signal( Cond ) pthread_cond_signal( &(Cond)->mCondition ) #elifdefined( HAVE_WIN32_THREAD ) #define Condition_Signal( Cond ) PulseEvent( (Cond)->mCondition ) #else #define Condition_Signal( Cond ) #endif
// send a condition signal to wake all threads waiting on condition #ifdefined( HAVE_POSIX_THREAD ) #define Condition_Broadcast( Cond ) pthread_cond_broadcast( &(Cond)->mCondition ) #elifdefined( HAVE_WIN32_THREAD ) #define Condition_Broadcast( Cond ) PulseEvent( (Cond)->mCondition ) #else #define Condition_Broadcast( Cond ) #endif
#endif// CONDITION_H
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.