- now the mess with threads has gone away
- 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
This commit is contained in:
35
core/synchro.cpp
Executable file
35
core/synchro.cpp
Executable file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user