ASAGI
1.0
a pArallel Server for Adaptive GeoInformation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
threads
pthreadmutex.h
Go to the documentation of this file.
1
38
#ifndef THREADS_PTHREADMUTEX_H
39
#define THREADS_PTHREADMUTEX_H
40
41
#ifndef USE_PTHREAD
42
#error "PThreads are not enabled."
43
#endif // USE_PTHREAD
44
45
#include <pthread.h>
46
47
namespace
threads
48
{
49
53
class
PthreadMutex
54
{
55
private
:
57
pthread_spinlock_t
m_lock
;
58
59
public
:
60
PthreadMutex
()
61
{
62
pthread_spin_init(&
m_lock
, PTHREAD_PROCESS_PRIVATE);
63
}
64
65
~
PthreadMutex
()
66
{
67
pthread_spin_destroy(&
m_lock
);
68
}
69
73
void
lock
()
74
{
75
pthread_spin_lock(&
m_lock
);
76
}
77
81
bool
try_lock
()
82
{
83
return
pthread_spin_trylock(&
m_lock
) == 0;
84
}
85
89
void
unlock
()
90
{
91
pthread_spin_unlock(&
m_lock
);
92
}
93
};
94
95
}
96
97
#endif // THREADS_PTHREADMUTEX_H
threads::PthreadMutex::lock
void lock()
Definition:
pthreadmutex.h:73
threads::PthreadMutex::unlock
void unlock()
Definition:
pthreadmutex.h:89
threads::PthreadMutex
Definition:
pthreadmutex.h:53
threads::PthreadMutex::m_lock
pthread_spinlock_t m_lock
Definition:
pthreadmutex.h:57
threads::PthreadMutex::try_lock
bool try_lock()
Definition:
pthreadmutex.h:81
Generated by
1.8.7