Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMutex.cpp
More file actions
Latest commit
executable file
·32 lines (25 loc) · 1.03 KB
/
Copy pathMutex.cpp
File metadata and controls
executable file
·32 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/***************************************************************************
* Copyright (C) 2003 by eddiedu *
* eddiedu@scale.com.br *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include"Mutex.h"
Mutex::Mutex(void){
pthread_mutex_init(&m_Mutex,(pthread_mutexattr_t*)NULL);
}
Mutex::~Mutex(void){
pthread_mutex_destroy(&m_Mutex);
}
voidMutex::Acquire(void){
pthread_mutex_lock(&m_Mutex);
}
intMutex::Acquired(void){
return (pthread_mutex_trylock(&m_Mutex) == 0);
}
voidMutex::Release(void){
pthread_mutex_unlock(&m_Mutex);
}