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

question about threads_keepalive variable. #88

Open
wind0ws opened this issue Jul 10, 2020 · 1 comment
Open

question about threads_keepalive variable. #88

wind0ws opened this issue Jul 10, 2020 · 1 comment

Comments

@wind0ws
Copy link

wind0ws commented Jul 10, 2020

Hi, thanks for this awesome lib.

In thpool.c (line 37), here is static volatile int threads_keepalive; , why not put threads_keepalive on struct thpool_?

Assume the following scenario:

  1. Create thread pool A (Now threads_keepalive is set to 1);
  2. Call add_task on thread pool A;
  3. Create thread pool B (Now threads_keepalive is set to 1);
  4. Call add_task on thread pool B;
  5. Destroy thread pool A (Now threads_keepalive is set to 0);
  6. Call add_task on thread pool B ; ( task won't execute, because of threads_keepalive == 0 )
@forGGe
Copy link

forGGe commented Apr 13, 2021

Just stumbled with similar issue. In my application, thread pool B isn't scheduling tasks if thread pool A is destroyed.

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