| 238 | } |
| 239 | |
| 240 | void private_worker::start_shutdown() { |
| 241 | state_t s; |
| 242 | |
| 243 | do { |
| 244 | s = my_state; |
| 245 | __TBB_ASSERT( s!=st_quit, NULL ); |
| 246 | } while( my_state.compare_and_swap( st_quit, s )!=s ); |
| 247 | if( s==st_normal || s==st_starting ) { |
| 248 | // May have invalidated invariant for sleeping, so wake up the thread. |
| 249 | // Note that the notify() here occurs without maintaining invariants for my_slack. |
| 250 | // It does not matter, because my_state==st_quit overrides checking of my_slack. |
| 251 | my_thread_monitor.notify(); |
| 252 | // Do not need release handle in st_init state, |
| 253 | // because in this case the thread wasn't started yet. |
| 254 | // For st_starting release is done at launch site. |
| 255 | if (s==st_normal) |
| 256 | release_handle(my_handle); |
| 257 | } else if( s==st_init ) { |
| 258 | // Perform action that otherwise would be performed by associated thread when it quits. |
| 259 | my_server.remove_server_ref(); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | void private_worker::run() { |
| 264 | my_server.propagate_chain_reaction(); |
no test coverage detected