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

Method push

benchmarks/tbb/task_stream.h:99–111  ·  view source on GitHub ↗

Push a task into a lane.

Source from the content-addressed store, hash-verified

97
98 //! Push a task into a lane.
99 void push( task* source, FastRandom& random ) {
100 // Lane selection is random. Each thread should keep a separate seed value.
101 unsigned idx;
102 for( ; ; ) {
103 idx = random.get() & (N-1);
104 spin_mutex::scoped_lock lock;
105 if( lock.try_acquire(lanes[idx].my_mutex) ) {
106 lanes[idx].my_queue.push_back(source);
107 set_one_bit( population, idx ); //TODO: avoid atomic op if the bit is already set
108 break;
109 }
110 }
111 }
112
113 //! Try finding and popping a task.
114 task* pop( unsigned& last_used_lane ) {

Callers

nothing calls this directly

Calls 4

set_one_bitFunction · 0.85
getMethod · 0.45
try_acquireMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected