{
ifdef WIN32
//do windows specific things here...
#endif
#ifdef __linux__
pthread_mutex_lock(&mutex);
flag--;
pthread_mutex_unlock(&mutex);
#endif
}
void CPrcThread
{
#ifdef WIN32
//do windows specific things here...
#endif
#ifdef __linux__
pthread_mutex_lock(&mutex);
flag++;
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
#endif
}
void* CPrcThread
{
while(1)
{
#ifdef WIN32
//do windows specific things here...
//no member variables accessed here so its ok...
#endif
#ifdef __linux__
pthread_mutex_lock(&mutex);
while(flag <= 0)
{
pthread_cond_wait(&cond, &mutex);
}
pthread_mutex_unlock(&mutex);
#endif
//actual thread work here
}
}[/code]