| 34 | } |
| 35 | |
| 36 | void concurrent_monitor::prepare_wait( thread_context& thr, uintptr_t ctx ) { |
| 37 | if( !thr.ready ) |
| 38 | thr.init(); |
| 39 | // this is good place to pump previous spurious wakeup |
| 40 | else if( thr.spurious ) { |
| 41 | thr.spurious = false; |
| 42 | thr.semaphore().P(); |
| 43 | } |
| 44 | thr.context = ctx; |
| 45 | thr.in_waitset = true; |
| 46 | { |
| 47 | tbb::spin_mutex::scoped_lock l( mutex_ec ); |
| 48 | __TBB_store_relaxed( thr.epoch, __TBB_load_relaxed(epoch) ); |
| 49 | waitset_ec.add( (waitset_t::node_t*)&thr ); |
| 50 | } |
| 51 | atomic_fence(); |
| 52 | } |
| 53 | |
| 54 | void concurrent_monitor::cancel_wait( thread_context& thr ) { |
| 55 | // spurious wakeup will be pumped in the following prepare_wait() |
no test coverage detected