44 lines
534 B
C++
Executable File
44 lines
534 B
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010-2012, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_core_synchro
|
|
#define headerfile_winix_core_synchro
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
struct Synchro
|
|
{
|
|
// one global mutex
|
|
pthread_mutex_t mutex;
|
|
|
|
|
|
// true when winix is closing
|
|
volatile bool was_stop_signal;
|
|
|
|
|
|
Synchro();
|
|
|
|
bool Lock();
|
|
void Unlock();
|
|
|
|
private:
|
|
|
|
// deadlock counter
|
|
// we can call Lock() more than one in the same thread
|
|
int ref;
|
|
|
|
};
|
|
|
|
|
|
#endif
|
|
|
|
|