Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a #112

Open
fanhoumin opened this issue Apr 27, 2024 · 1 comment
Open

a #112

fanhoumin opened this issue Apr 27, 2024 · 1 comment

Comments

@fanhoumin
Copy link

fanhoumin commented Apr 27, 2024

When I use your thread library, I encountered an interesting issue. Is the following conditional redundant? Because theoretically, if our thread is not in a stopped state but the task queue is empty, it shouldn't leave the waiting state.std::unique_lock<std::mutex> lock(this->queue_mutex); this->condition.wait(lock, [this]{ return this->stop || !this->tasks.empty(); }); if(this->stop && this->tasks.empty()) return;

@Smalldy
Copy link

Smalldy commented Oct 18, 2024

if stop == true and tasks is empty, it will leave the waiting . This mean we were finished our tasks, then return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants