Skip to content

Commit

Permalink
Prepare for publishing.
Browse files Browse the repository at this point in the history
Add a license and some metadata, tweak readme.
  • Loading branch information
vincentdephily committed Feb 2, 2018
1 parent 571b389 commit 3432f02
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[package]
name = "threadgroup"
version = "0.1.0"
authors = ["Vincent de Phily <[email protected]>"]
authors = ["Vincent de Phily <[email protected]>"]
description = "Manage groups of threads as one unit, join the first one that finishes, timeout on join attempts."
readme = "README.md"
license = "MIT"
categories = ["concurrency"]
keywords = ["thread", "timeout"]
repository = "https://github.com/vincentdephily/threadgroup"
documentation = "https://docs.rs/threadgroup"

[dependencies]
9 changes: 9 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2018 Vincent de Phily

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# ThreadGroup

This crate handles a group of threads (whose closures have the same return type) as one unit,
letting you `join()` or `join_timeout()` on the first thread of the group that is ready.
letting you `join()` or `join_timeout()` on the first thread of the group that is ready. Internally,
it uses a channel to notify about finished threads.

This is useful when you want to check whether any one of your threads has panicked or returned
early, for error-handling or for progress report. This isn't possible with Rust's
early, for error-handling or for progress report. This isn't possible with
`std::thread::JoinHanlde.join()` because it is a blocking call, so thread 2 might panic or finish
while you're waiting indefinitely on thread 1.


# See also

If `ThreadGroup` isn't what you needed after all and can't be improved to suit your needs, have a
look at these other crates.
look at these other crates :

* [Thread_tryjoin](https://crates.io/crates/thread_tryjoin) gives the same benefit as
`ThreadGroup.join_timeout()` with an API that is closer to `std`'s. But it depends on a Linux-only
Expand All @@ -27,3 +28,13 @@ look at these other crates.
computations without repeatedly paying the high setup cost.
* [Future](https://crates.io/crates/futures) isn't related to threads but is often a better way to
handle "start task B whenever task A finishes" algorythms.


# Contributing

Please create issues and send pull request via
[Github](https://github.com/vincentdephily/threadgroup).

Threadgroup is licensed as MIT. Unless you explicitly state otherwise, any contribution
intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be
licensed as above, without any additional terms or conditions.

0 comments on commit 3432f02

Please sign in to comment.