| 121 | } |
| 122 | |
| 123 | TEST(BthreadCondBugTest, test_bug) { |
| 124 | bthread_t tids[PRODUCER_NUM]; |
| 125 | for (int i = 0; i < PRODUCER_NUM; i++) { |
| 126 | bthread_start_background(&tids[i], NULL, produce_func, (void*)(int64_t)i); |
| 127 | } |
| 128 | bthread_t tid; |
| 129 | bthread_start_background(&tid, NULL, consume_func, NULL); |
| 130 | |
| 131 | int64_t ret = (int64_t)print_func(nullptr); |
| 132 | |
| 133 | bthread_stop(tid); |
| 134 | bthread_join(tid, nullptr); |
| 135 | for (int i = 0; i < PRODUCER_NUM; i++) { |
| 136 | bthread_stop(tids[i]); |
| 137 | bthread_join(tids[i], nullptr); |
| 138 | } |
| 139 | |
| 140 | ASSERT_EQ(ret, 1); |
| 141 | } |
nothing calls this directly
no test coverage detected