@@ -507,7 +507,7 @@ TEST_CASE("WorkerQueue.OneThread" * doctest::timeout(300)) {
507507// ----------------------------------------------------------------------------
508508TEST_CASE (" WorkerQueue.TwoThread" * doctest::timeout (300 )) {
509509
510- constexpr size_t N = (1 << 20 );
510+ const static size_t N = (1 << 20 );
511511
512512 privatized_threadpool::RunQueue<int , 64 > queue;
513513
@@ -517,15 +517,15 @@ TEST_CASE("WorkerQueue.TwoThread" * doctest::timeout(300)) {
517517
518518 REQUIRE (queue.empty ());
519519
520- std::thread t1 ([&queue , i=0 ] () mutable {
520+ std::thread t1 ([&, i=0 ] () mutable {
521521 while (i < N) {
522522 if (queue.push_front (i)) {
523523 ++i;
524524 }
525525 }
526526 });
527527
528- std::thread t2 ([&queue , i=0 ] () mutable {
528+ std::thread t2 ([&, i=0 ] () mutable {
529529 int data;
530530 while (i < N) {
531531 if (queue.pop_back (data)) {
@@ -546,15 +546,15 @@ TEST_CASE("WorkerQueue.TwoThread" * doctest::timeout(300)) {
546546
547547 REQUIRE (queue.empty ());
548548
549- std::thread t1 ([&queue , i=0 ] () mutable {
549+ std::thread t1 ([&, i=0 ] () mutable {
550550 while (i < N) {
551551 if (queue.push_back (i)) {
552552 ++i;
553553 }
554554 }
555555 });
556556
557- std::thread t2 ([&queue , i=0 ] () mutable {
557+ std::thread t2 ([&, i=0 ] () mutable {
558558 int data;
559559 while (i < N) {
560560 if (queue.pop_front (data)) {
@@ -577,15 +577,15 @@ TEST_CASE("WorkerQueue.TwoThread" * doctest::timeout(300)) {
577577
578578 REQUIRE (queue.empty ());
579579
580- std::thread t1 ([&queue , i=0 ] () mutable {
580+ std::thread t1 ([&, i=0 ] () mutable {
581581 while (i < N) {
582582 if (queue.push_back (i)) {
583583 ++i;
584584 }
585585 }
586586 });
587587
588- std::thread t2 ([&queue , i=0 , &res ] () mutable {
588+ std::thread t2 ([&, i=0 ] () mutable {
589589 int data;
590590 while (i < N) {
591591 if (queue.pop_back (data)) {
@@ -624,23 +624,23 @@ TEST_CASE("WorkerQueue.TriThread" * doctest::timeout(300)) {
624624 // push front + push back + pop back
625625 REQUIRE (queue.empty ());
626626
627- std::thread t1 ([&queue , i=0 ] () mutable {
627+ std::thread t1 ([&, i=0 ] () mutable {
628628 while (i < N/2 ) {
629629 if (queue.push_front (i)) {
630630 ++i;
631631 }
632632 }
633633 });
634634
635- std::thread t2 ([&queue , i=N/2 ] () mutable {
635+ std::thread t2 ([&, i=N/2 ] () mutable {
636636 while (i < N) {
637637 if (queue.push_back (i)) {
638638 ++i;
639639 }
640640 }
641641 });
642642
643- std::thread t3 ([&queue , i=0 , &res ] () mutable {
643+ std::thread t3 ([&, i=0 ] () mutable {
644644 int data;
645645 while (i < N) {
646646 if (queue.pop_back (data)) {
0 commit comments