Skip to content

Add an example to illustrate the join() method#116

Open
mortie wants to merge 1 commit into
rust-threadpool:masterfrom
mortie:master
Open

Add an example to illustrate the join() method#116
mortie wants to merge 1 commit into
rust-threadpool:masterfrom
mortie:master

Conversation

@mortie
Copy link
Copy Markdown

@mortie mortie commented Apr 9, 2026

The most straightforward use of a thread pool is to execute some number of jobs, then wait for their completion. I had this need just now and reached for this crate, but I didn't realize that you could wait for all jobs to be done with the join() method, so I went looking for a countdown latch crate instead.

The barrier example sort of suggests that using some other syncronization primitive is a preferred way to wait for all jobs to be done. I think having a dedicated example to show the basic "spawn some workers then wait for them to complete" use case might help avoid confusion.

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.

1 participant