Skip to content

Conversation

@sandervdbosch
Copy link
Contributor

Add the ability to wait for the pool to finish all tasks without destroying all the threads in the pool.
This results in the new ThreadPool.join() function, while increasing the ThreadPool object by 56 bytes.

@sandervdbosch sandervdbosch marked this pull request as draft November 20, 2025 21:23
@lerno
Copy link
Collaborator

lerno commented Nov 20, 2025

Why did you mark it a draft?

@sandervdbosch
Copy link
Contributor Author

Yes, I noticed that the thread sleep excessively when using the join function. I will try to fix it and update the pull request.

…nstead of buzy looping and do proper initialization and freeing of all variables.
@sandervdbosch sandervdbosch marked this pull request as ready for review November 21, 2025 18:51
@lerno
Copy link
Collaborator

lerno commented Nov 22, 2025

Can you add some additional tests? I commented out some code that you added but all tests still passed, so see if you can add some more asserts on the behaviour.

@sandervdbosch
Copy link
Contributor Author

There are no tests for the FixedThreadPool, when I tried to add them it failed on memory leaks that I was not able to trace down.
Commenting out the changes I made does break functionality, although this is hard to test for the mutex locking and unlocking due to the limitation that the maximum queue size is the same as the amount of threads in the pool.

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

Successfully merging this pull request may close these issues.

2 participants