1 |
// Copyright (C) 2003 Stephane Thiell |
2 |
// |
3 |
// This file is part of pxyscand (from pxys) |
4 |
// |
5 |
// This program is free software; you can redistribute it and/or |
6 |
// modify it under the terms of the GNU General Public License |
7 |
// as published by the Free Software Foundation; either version 2 |
8 |
// of the License, or (at your option) any later version. |
9 |
// |
10 |
// This program is distributed in the hope that it will be useful, |
11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
// GNU General Public License for more details. |
14 |
// |
15 |
// You should have received a copy of the GNU General Public License |
16 |
// along with this program; if not, write to the Free Software |
17 |
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
// |
19 |
// $Id: PXMutex.h,v 1.1.1.1 2003/12/30 17:09:00 mbuna Exp $ |
20 |
// |
21 |
#ifndef INCLUDED_PXMUTEX_H_ |
22 |
#define INCLUDED_PXMUTEX_H_ |
23 |
|
24 |
#include <peak/peak.h> |
25 |
|
26 |
class PXMutex |
27 |
{ |
28 |
public: |
29 |
PXMutex(); |
30 |
virtual ~PXMutex(); |
31 |
|
32 |
virtual void Lock() { peak_task_mutex_lock(mMutex); } |
33 |
virtual void Unlock() { peak_task_mutex_unlock(mMutex); } |
34 |
|
35 |
protected: |
36 |
peak_task_mutex mMutex; |
37 |
}; |
38 |
|
39 |
class StPXMutex |
40 |
{ |
41 |
public: |
42 |
StPXMutex(PXMutex *_m) : m(_m) { m->Lock(); } |
43 |
virtual ~StPXMutex() { m->Unlock(); } |
44 |
protected: |
45 |
PXMutex *m; |
46 |
}; |
47 |
|
48 |
|
49 |
#endif // INCLUDED_PXMUTEX_H_ |