Hi,
My comp is also without russian kbd :(
If I understood you right you need something which will work like WaitForMultipleObjects()... For that purpose you can use pthread_join or something like this:
void wait4sem( sem_t *s )
{
while ( sem_wait( s ) != 0 ) ;
}
void wait4many_objects( sem_t *s, int how_many )
{
while ( how_many > 0 ) {
wait4sem( s );
how_many--;
}
}
Also I'm very often using conditional variables for purpose like this.
Please take a look at pthread_cond_wait; pthread_cond_timedwait etc.
May be it will help you. Be aware that to increase chances that thread, which just got wake up get mutex before check condition it is better to call broadcast or signal outside of critical section.
for example:
thread_1
=================================
pthread_mutex_lock( &m );
while ( !your_cond )
pthread_cond_wait( &cond, &m );
do_something();
pthread_mutex_unlock( &m );
thread_2
=================================
pthread_mutex_lock( &m );
your_cond = true;
pthread_mutex_unlock( &m );
/* signal outside of critical section */
pthread_cond_signal( &cond );
Hope this helps
--- sas