File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -349,12 +349,14 @@ class ConcurrentQueueTests : public TestClass<ConcurrentQueueTests>
349
349
REGISTER_TEST (index_wrapping);
350
350
REGISTER_TEST (subqueue_size_limit);
351
351
REGISTER_TEST (exceptions);
352
+ REGISTER_TEST (implicit_producer_churn);
352
353
REGISTER_TEST (test_threaded);
353
354
REGISTER_TEST (test_threaded_bulk);
354
355
REGISTER_TEST (full_api<ConcurrentQueueDefaultTraits>);
355
356
REGISTER_TEST (full_api<SmallIndexTraits>);
356
357
REGISTER_TEST (blocking_wrappers);
357
358
REGISTER_TEST (timed_blocking_wrappers);
359
+
358
360
// c_api/concurrentqueue
359
361
REGISTER_TEST (c_api_create);
360
362
REGISTER_TEST (c_api_enqueue);
@@ -3078,6 +3080,29 @@ class ConcurrentQueueTests : public TestClass<ConcurrentQueueTests>
3078
3080
3079
3081
return true ;
3080
3082
}
3083
+
3084
+ bool implicit_producer_churn ()
3085
+ {
3086
+ typedef TestTraits<4 > Traits;
3087
+
3088
+ for (int i = 0 ; i != 256 ; ++i) {
3089
+ std::vector<SimpleThread> threads (32 );
3090
+ ConcurrentQueue<int , Traits> q;
3091
+ for (auto & thread : threads) {
3092
+ SimpleThread t ([&] {
3093
+ int x;
3094
+ for (int j = 0 ; j != 16 ; ++j) {
3095
+ q.enqueue (0 );
3096
+ q.try_dequeue (x);
3097
+ }
3098
+ });
3099
+ }
3100
+ for (auto & thread : threads) {
3101
+ thread.join ();
3102
+ }
3103
+ }
3104
+ return true ;
3105
+ }
3081
3106
3082
3107
bool test_threaded ()
3083
3108
{
You can’t perform that action at this time.
0 commit comments