- we have a class BaseThread -- this is a base class -- we can inherit from it when creating a new thread - others treads are correctly stopped (when signal comes) -- pthread_join - we have a special thread only for signals git-svn-id: svn://ttmath.org/publicrep/winix/trunk@685 e52654a7-88a9-db11-a3e9-0013d4bc506e
36 lines
385 B
C++
Executable File
36 lines
385 B
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "synchro.h"
|
|
|
|
|
|
|
|
Synchro::Synchro() : mutex(PTHREAD_MUTEX_INITIALIZER)
|
|
{
|
|
was_stop_signal = false;
|
|
}
|
|
|
|
|
|
|
|
bool Synchro::Lock()
|
|
{
|
|
return pthread_mutex_lock(&mutex) == 0;
|
|
}
|
|
|
|
|
|
void Synchro::Unlock()
|
|
{
|
|
pthread_mutex_unlock(&mutex);
|
|
}
|
|
|
|
|
|
|
|
|
|
|