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

How does this work?? #132

Open
neo2043 opened this issue Aug 5, 2024 · 0 comments
Open

How does this work?? #132

neo2043 opened this issue Aug 5, 2024 · 0 comments

Comments

@neo2043
Copy link

neo2043 commented Aug 5, 2024

I am trying to make a cross platform threadpool library in c and I came across this library and I started to examine it but I don't get it how is it working.
The thing that I don't understand is that for example if I have 4 threads in the threadpool and I give all 4 of them work to do and its going to take a long time, in this case 1 minute, if I add 20 work into the queue before the 1 minute mark, they all will signal for threads but no one will be able to get that signal (as they are not waiting for any signal) and miss the signal and then I noticed that you added an integer v in bsem because of it it will take atleast one job after the first initial intensive job but then after this how does the thread know if there are any jobs left in the queue. There is no signal to inform the threads and the integer v is 0 after taking the 2nd job.
I tried this library in linux because of signals .I made the above mentioned scenario, and it still worked. I don't get it how is it working.
Any help would be appreciated.

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

1 participant