Project

General

Profile

Statistics
| Branch: | Revision:

root / src / sim / cpthreadlock.cc @ e26d3d25

History | View | Annotate | Download (898 Bytes)

1 2c43d39b Simon Tenbusch
//==========================================================================
2
//  CPTHREADLOCK.CC - part of
3
//
4
//                     Horizon/OMNeT++/OMNEST
5
//            Discrete System Simulation in C++
6
//
7
//==========================================================================
8
9
/*--------------------------------------------------------------*
10 e118c57b Simon Tenbusch
 Copyright (C) 2011 Simon Tenbusch
11 2c43d39b Simon Tenbusch

12 e118c57b Simon Tenbusch
 This file is distributed WITHOUT ANY WARRANTY. See the file
13
 `license' for details on this and other legal matters.
14 2c43d39b Simon Tenbusch
 *--------------------------------------------------------------*/
15
16
#include "simkerneldefs.h"
17
#include "cpthreadlock.h"
18
19 e118c57b Simon Tenbusch
cPThreadLock::cPThreadLock()
20
{
21
    pthread_mutex_init(&mutex, NULL);
22
}
23
24
cPThreadLock::~cPThreadLock()
25
{
26
    pthread_mutex_destroy(&mutex);
27
}
28
29
void cPThreadLock::lock()
30
{
31
    pthread_mutex_lock(&mutex);
32
}
33
34
void cPThreadLock::unlock()
35
{
36
    pthread_mutex_unlock(&mutex);
37
}