OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mathieu Lacage <mathieu.lacage.inria.fr> | 18 * Author: Mathieu Lacage <mathieu.lacage.inria.fr> |
19 */ | 19 */ |
20 | 20 |
21 #ifndef SYSTEM_MUTEX_H | 21 #ifndef SYSTEM_MUTEX_H |
22 #define SYSTEM_MUTEX_H | 22 #define SYSTEM_MUTEX_H |
23 | 23 |
24 #include "ptr.h" | 24 #include "ptr.h" |
25 | 25 |
| 26 #include "ns3/ns3-module.h" |
| 27 #define NS3_MODULE NS3_CORE_MODULE |
| 28 #include "ns3/ns3-export.h" |
| 29 |
26 /** | 30 /** |
27 * @file | 31 * @file |
28 * @ingroup thread | 32 * @ingroup thread |
29 * System-independent mutex primitive, ns3::SystemMutex, | 33 * System-independent mutex primitive, ns3::SystemMutex, |
30 * and ns3::CriticalSection. | 34 * and ns3::CriticalSection. |
31 */ | 35 */ |
32 | 36 |
33 namespace ns3 {· | 37 namespace ns3 {· |
34 ········ | 38 ········ |
35 class SystemMutexPrivate; | 39 class SystemMutexPrivate; |
(...skipping 12 matching lines...) Expand all Loading... |
48 * There are two operations: Lock and Unlock. Lock allows an executing· | 52 * There are two operations: Lock and Unlock. Lock allows an executing· |
49 * SystemThread to attempt to acquire ownership of the Mutual Exclusion· | 53 * SystemThread to attempt to acquire ownership of the Mutual Exclusion· |
50 * object. If the SystemMutex object is not owned by another thread, then | 54 * object. If the SystemMutex object is not owned by another thread, then |
51 * ownership is granted to the calling SystemThread and Lock returns· | 55 * ownership is granted to the calling SystemThread and Lock returns· |
52 * immediately, However, if the SystemMutex is already owned by another | 56 * immediately, However, if the SystemMutex is already owned by another |
53 * SystemThread, the calling SystemThread is blocked until the current owner | 57 * SystemThread, the calling SystemThread is blocked until the current owner |
54 * releases the SystemMutex by calling Unlock. | 58 * releases the SystemMutex by calling Unlock. |
55 * | 59 * |
56 * @see CriticalSection | 60 * @see CriticalSection |
57 */ | 61 */ |
58 class SystemMutex· | 62 class NS3_EXPORT SystemMutex· |
59 { | 63 { |
60 public: | 64 public: |
61 SystemMutex (); | 65 SystemMutex (); |
62 ~SystemMutex (); | 66 ~SystemMutex (); |
63 | 67 |
64 /** | 68 /** |
65 * Acquire ownership of the Mutual Exclusion object. | 69 * Acquire ownership of the Mutual Exclusion object. |
66 */ | 70 */ |
67 void Lock (); | 71 void Lock (); |
68 | 72 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 * ... | 112 * ... |
109 * } | 113 * } |
110 * @endcode | 114 * @endcode |
111 * Here, the critical section is entered partway through the method when the | 115 * Here, the critical section is entered partway through the method when the |
112 * CriticalSection object is created in the local scope block (the braces). | 116 * CriticalSection object is created in the local scope block (the braces). |
113 * The critical section is exited when the CriticalSection object goes out of | 117 * The critical section is exited when the CriticalSection object goes out of |
114 * scope at the end of block. | 118 * scope at the end of block. |
115 * | 119 * |
116 * @see SystemMutex | 120 * @see SystemMutex |
117 */ | 121 */ |
118 class CriticalSection | 122 class NS3_EXPORT CriticalSection |
119 { | 123 { |
120 public: | 124 public: |
121 /** | 125 /** |
122 * Construct with the required SystemMutex. | 126 * Construct with the required SystemMutex. |
123 * | 127 * |
124 * @param [in] mutex The mutex. | 128 * @param [in] mutex The mutex. |
125 */ | 129 */ |
126 CriticalSection (SystemMutex &mutex); | 130 CriticalSection (SystemMutex &mutex); |
127 /** Destructor */ | 131 /** Destructor */ |
128 ~CriticalSection (); | 132 ~CriticalSection (); |
129 private: | 133 private: |
130 SystemMutex &m_mutex; /**< The mutex. */ | 134 SystemMutex &m_mutex; /**< The mutex. */ |
131 }; | 135 }; |
132 | 136 |
133 } // namespace ns3 | 137 } // namespace ns3 |
134 | 138 |
135 #endif /* SYSTEM_MUTEX_H */ | 139 #endif /* SYSTEM_MUTEX_H */ |
OLD | NEW |