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

Resuming a threadpool resumes all #13

Open
Pithikos opened this issue Apr 17, 2015 · 2 comments
Open

Resuming a threadpool resumes all #13

Pithikos opened this issue Apr 17, 2015 · 2 comments

Comments

@Pithikos
Copy link
Owner

At the moment pause/resume synchronisation commands affect all thread pools. Someone issuing thpool_pause(thpool) will cause all thread pools to pause for example even if only one thread pool is passed as argument.

To work around this, all thread specific variables should be bundled inside the thread pool structure.

(initial report: #11)

@marwankallal
Copy link
Contributor

I see that thpool_resume() is global, but doesn't the pthread_kill(thpool_p->threads[n]->pthread, SIGUSR1) in thpool_pause() keep the pausing thread pool specific?

@Pithikos
Copy link
Owner Author

Pithikos commented Oct 9, 2016

You're probably right. Not sure why I wrote that when I did. In any case this should be changed since it's not consistent.

As I see it either thpool_resume should resume only the given threadpool or in the short term it should be renamed to thpool_resume_all to make it clearer what's happening, and then it shouldn't take any arguments either since it acts on a global variable.

Resuming a single thread pool probably requires a bit more work; a variable on the thread pool itself instead of a global and then probably some thinking on how the signalling should work (thread_hold).

@Pithikos Pithikos changed the title Sync-functions should be thread pool specific Resuming a threadpool resumes all Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants