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

Method thread

tests/relacy/integrated.cpp:512–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510 }
511
512 void thread(unsigned int tid)
513 {
514 RelacyThreadExitNotifier::notify_relacy_thread_start();
515
516 if (tid <= 1) {
517 for (int i = 0; i != 7; ++i) {
518 q.enqueue(tid * 7 + i);
519 }
520 }
521 else {
522 ProducerToken t(q);
523 for (int i = 0; i != 7; ++i) {
524 q.enqueue(t, tid * 7 + i);
525 }
526 }
527
528 int item;
529 if (tid & 1) {
530 for (int i = 0; i != 4; ++i) {
531 if (q.try_dequeue(item)) {
532 RL_ASSERT(!seen[item]);
533 seen[item] = true;
534 }
535 }
536 }
537 else {
538 ConsumerToken t(q);
539 for (int i = 0; i != 4; ++i) {
540 if (q.try_dequeue(t, item)) {
541 RL_ASSERT(!seen[item]);
542 seen[item] = true;
543 }
544 }
545 }
546
547 RelacyThreadExitNotifier::notify_relacy_thread_exit();
548 }
549
550 void after()
551 {

Callers

nothing calls this directly

Calls 2

enqueueMethod · 0.45
try_dequeueMethod · 0.45

Tested by

no test coverage detected