MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / prepare_wait

Method prepare_wait

benchmarks/tbb/concurrent_monitor.cpp:36–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void 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
54void concurrent_monitor::cancel_wait( thread_context& thr ) {
55 // spurious wakeup will be pumped in the following prepare_wait()

Callers 4

internal_insert_itemMethod · 0.45
internal_popMethod · 0.45
internal_executeMethod · 0.45
runMethod · 0.45

Calls 7

__TBB_store_relaxedFunction · 0.85
__TBB_load_relaxedFunction · 0.85
atomic_fenceFunction · 0.85
initMethod · 0.45
PMethod · 0.45
semaphoreMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected