~aavoodoo/+junk/0.2.8-armagetronad-norenderer

« back to all changes in this revision

Viewing changes to src/tools/pthread-binding.h

  • Committer: epsy
  • Date: 2008-09-30 17:08:54 UTC
  • Revision ID: svn-v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs:7d95bf1e-0414-0410-9756-b78462a59f44:armagetronad%2Fbranches%2F0.2.8%2Farmagetronad:8588
Reverted epsy's revert
Will follow up with configure-disabling
------------------------------------------------------------------------
r8587 | bazaarmagetron | 2008-10-11 12:54:01 -0500 (Sat, 11 Oct 2008) | 2 lines

epsy: Removed luke's breaking changes, as they are breaking and have been given no attention in weeks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <pthread.h>
 
2
 
 
3
class tPThreadMutex
 
4
{
 
5
private:
 
6
    pthread_mutex_t mutex;
 
7
public:
 
8
    tPThreadMutex() {
 
9
        // TODO: error checking
 
10
        pthread_mutexattr_t mta;
 
11
        
 
12
        pthread_mutex_init(&mutex, &mta);
 
13
    }
 
14
    void acquire() {
 
15
        pthread_mutex_lock(&mutex);
 
16
    };
 
17
    void release() {
 
18
        pthread_mutex_unlock(&mutex);
 
19
    };
 
20
};
 
21
 
 
22
class tPThreadRecursiveMutex
 
23
 : public tPThreadMutex
 
24
{
 
25
private:
 
26
    pthread_mutex_t mutex;
 
27
public:
 
28
    tPThreadRecursiveMutex() {
 
29
        // TODO: error checking
 
30
        pthread_mutexattr_t mta;
 
31
        
 
32
        pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);
 
33
        pthread_mutex_init(&mutex, &mta);
 
34
    }
 
35
};