|
1
|
1 #include "pfc.h"
|
|
|
2
|
|
|
3 #ifndef _WIN32
|
|
|
4
|
|
|
5 namespace pfc {
|
|
|
6
|
|
|
7 void mutexBase::create( const pthread_mutexattr_t * attr ) {
|
|
|
8 if (pthread_mutex_init( &obj, attr) != 0) {
|
|
|
9 throw exception_bug_check();
|
|
|
10 }
|
|
|
11 }
|
|
|
12 void mutexBase::destroy() {
|
|
|
13 pthread_mutex_destroy( &obj );
|
|
|
14 }
|
|
|
15 void mutexBase::createRecur() {
|
|
|
16 mutexAttr a; a.setRecursive(); create(&a.attr);
|
|
|
17 }
|
|
|
18 void mutexBase::create( const mutexAttr & a ) {
|
|
|
19 create( & a.attr );
|
|
|
20 }
|
|
|
21
|
|
|
22 void readWriteLockBase::create( const pthread_rwlockattr_t * attr ) {
|
|
|
23 if (pthread_rwlock_init( &obj, attr) != 0) {
|
|
|
24 throw exception_bug_check();
|
|
|
25 }
|
|
|
26 }
|
|
|
27 void readWriteLockBase::create( const readWriteLockAttr & a) {
|
|
|
28 create(&a.attr);
|
|
|
29 }
|
|
|
30
|
|
|
31 }
|
|
|
32
|
|
|
33 #endif // _WIN32
|