-
Notifications
You must be signed in to change notification settings - Fork 286
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Deadlock caused by reset
It is necessary to lock running during reset
Otherwise, if the thread is in the process of judging the end of running, but has not yet waited, the running has been modified and has been notified_ All, it will deadlock
The probability of deadlock is very low, but it may still occur.
On my local machine, a deadlock occurred when using GCC12.2 for testing
BS::thread_pool pool;
void func() {
pool.pause();
for (int i = 0; i < 32; ++i) {
pool.push_task([]() {return 0; });
}
pool.unpause();
for (int i = 0; i < 32; ++i) {
pool.reset();
}
pool.wait_for_tasks();
}
int main() {
for (int i = 0; i < 1e3; ++i) {
func();
printf("%d ", i);
}
printf("done\n");
return 0;
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working