equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MONITOR_H |
|
20 #define MONITOR_H |
|
21 |
|
22 #include <pthread.h> |
|
23 #include "javaosheaders.h" |
|
24 |
|
25 namespace java |
|
26 { |
|
27 namespace util |
|
28 { |
|
29 |
|
30 class Monitor |
|
31 { |
|
32 |
|
33 public: |
|
34 //Constructor(s) & destructor |
|
35 virtual ~Monitor(); |
|
36 |
|
37 //API |
|
38 OS_IMPORT static Monitor* createMonitor(); |
|
39 OS_IMPORT int wait(int timeOut = 0); |
|
40 OS_IMPORT int notify(); |
|
41 |
|
42 |
|
43 private: //Methods |
|
44 Monitor(); |
|
45 Monitor(const Monitor&); //No copy constructor allowed |
|
46 Monitor& operator= (const Monitor&); //No Assignment operator allowed |
|
47 |
|
48 private: //Members |
|
49 pthread_mutex_t mMutex; |
|
50 pthread_cond_t mCondVar; |
|
51 bool mWaiting; |
|
52 bool mNotifyBeforeWait; |
|
53 }; |
|
54 |
|
55 } //end namespace util |
|
56 } //end namespace java |
|
57 #endif // MONITOR_H |
|
58 |