|
96 |
* |
96 |
* |
97 |
* @warning The SystemThread uses SIGALRM to wake threads that are possibly |
97 |
* @warning The SystemThread uses SIGALRM to wake threads that are possibly |
98 |
* blocked on IO. |
98 |
* blocked on IO. |
99 |
* @see Shutdown |
|
|
100 |
* |
99 |
* |
101 |
* @warning I've made the system thread class look like a normal ns3 object |
100 |
* @warning I've made the system thread class look like a normal ns3 object |
102 |
* with smart pointers, and living in the heap. This makes it very easy to |
101 |
* with smart pointers, and living in the heap. This makes it very easy to |
|
126 |
*/ |
125 |
*/ |
127 |
void Join (void); |
126 |
void Join (void); |
128 |
|
127 |
|
129 |
/** |
|
|
130 |
* @brief Indicates to a managed thread doing cooperative multithreading that |
131 |
* its managing thread wants it to exit. |
132 |
* |
133 |
* It is often the case that we want a thread to be off doing work until such |
134 |
* time as its job is done (typically when the simulation is done). We then |
135 |
* want the thread to exit itself. This method provides a consistent way for |
136 |
* the managing thread to communicate with the managed thread. After the |
137 |
* manager thread calls this method, the Break() method will begin returning |
138 |
* true, telling the managed thread to exit. |
139 |
* |
140 |
* This alone isn't really enough to merit these events, but in Unix, if a |
141 |
* worker thread is doing blocking IO, it will need to be woken up from that |
142 |
* read somehow. This method also provides that functionality, by sending a |
143 |
* SIGALRM signal to the possibly blocked thread. |
144 |
* |
145 |
* @warning Uses SIGALRM to notify threads possibly blocked on IO. Beware |
146 |
* if you are using signals. |
147 |
* @see Break |
148 |
*/ |
149 |
void Shutdown (void); |
150 |
|
151 |
/** |
152 |
* @brief Indicates to a thread doing cooperative multithreading that |
153 |
* its managing thread wants it to exit. |
154 |
* |
155 |
* It is often the case that we want a thread to be off doing work until such |
156 |
* time as its job is done. We then want the thread to exit itself. This |
157 |
* method allows a thread to query whether or not it should be running. |
158 |
* Typically, the worker thread is running in a forever-loop, and will need to |
159 |
* "break" out of that loop to exit -- thus the name. |
160 |
* |
161 |
* @see Shutdown |
162 |
* @returns true if thread is expected to exit (break out of the forever-loop) |
163 |
*/ |
164 |
bool Break (void); |
165 |
|
166 |
private: |
128 |
private: |
167 |
SystemThreadImpl * m_impl; |
129 |
SystemThreadImpl * m_impl; |
168 |
bool m_break; |
|
|
169 |
}; |
130 |
}; |
170 |
|
131 |
|
171 |
} //namespace ns3 |
132 |
} //namespace ns3 |