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

Method register_successor

benchmarks/tbb/flow_graph.h:1332–1349  ·  view source on GitHub ↗

override */

Source from the content-addressed store, hash-verified

1330#endif
1331
1332 /* override */ bool register_successor( successor_type &s ) {
1333 spin_mutex::scoped_lock l( my_mutex );
1334 task* tp = this->my_graph.root_task(); // just to test if we are resetting
1335 if (my_buffer_is_valid && tp) {
1336 // We have a valid value that must be forwarded immediately.
1337 if ( s.try_put( my_buffer ) || !s.register_predecessor( *this ) ) {
1338 // We add the successor: it accepted our put or it rejected it but won't let us become a predecessor
1339 my_successors.register_successor( s );
1340 } else {
1341 // We don't add the successor: it rejected our put and we became its predecessor instead
1342 return false;
1343 }
1344 } else {
1345 // No valid value yet, just add as successor
1346 my_successors.register_successor( s );
1347 }
1348 return true;
1349 }
1350
1351 /* override */ bool remove_successor( successor_type &s ) {
1352 spin_mutex::scoped_lock l( my_mutex );

Callers

nothing calls this directly

Calls 4

root_taskMethod · 0.80
try_putMethod · 0.45
register_predecessorMethod · 0.45
register_successorMethod · 0.45

Tested by

no test coverage detected