| 219 | |
| 220 | |
| 221 | class test5 : private multithreaded_object |
| 222 | { |
| 223 | public: |
| 224 | test5() |
| 225 | { |
| 226 | register_thread(*this,&test5::thread1); |
| 227 | register_thread(*this,&test5::thread2); |
| 228 | register_thread(*this,&test5::thread3); |
| 229 | register_thread(*this,&test5::thread3); |
| 230 | start(); |
| 231 | } |
| 232 | |
| 233 | ~test5() |
| 234 | { |
| 235 | stop(); |
| 236 | wait(); |
| 237 | } |
| 238 | |
| 239 | private: |
| 240 | |
| 241 | void thread1() |
| 242 | { |
| 243 | while (!should_stop()) |
| 244 | dlib::sleep(10); |
| 245 | } |
| 246 | |
| 247 | void thread2() |
| 248 | { |
| 249 | while (!should_stop()) |
| 250 | dlib::sleep(10); |
| 251 | } |
| 252 | |
| 253 | void thread3() |
| 254 | { |
| 255 | while (!should_stop()) |
| 256 | dlib::sleep(10); |
| 257 | } |
| 258 | |
| 259 | }; |
| 260 | |
| 261 | |
| 262 | void multithreaded_object_test ( |
no outgoing calls