README.markdown in in_threads-1.4.0 vs README.markdown in in_threads-1.5.0
- old
+ new
@@ -4,11 +4,11 @@
[](https://gemnasium.com/toy/in_threads)
[](https://inch-ci.org/github/toy/in_threads)
# in_threads
-Easily execute Ruby code in parallel.
+Run all possible enumerable methods in concurrent/parallel threads.
```ruby
urls.in_threads(20).map do |url|
HTTP.get(url)
end
@@ -26,11 +26,11 @@
```sh
$ bundle install
```
-Or, if you don't use Bundler, install it globally:
+Or install globally:
```sh
$ gem install in_threads
```
@@ -92,8 +92,16 @@
You can call any `Enumerable` method, but some (`#inject`, `#reduce`, `#max`,
`#min`, `#sort`, `#to_a`, and others) cannot run concurrently, and so will
simply act as if `in_threads` wasn't used.
+### Break and exceptions
+
+Exceptions are caught and re-thrown after allowing blocks that are still running to finish.
+
+**IMPORTANT**: only the first encountered exception is propagated, so it is recommended to handle exceptions in the block.
+
+`break` is handled in ruby >= 1.9 and should be handled in jruby [after 9.1.9.0](https://github.com/jruby/jruby/issues/4697). Handling is done in special way: as blocks are run outside of original context, calls to `break` cause `LocalJumpError` which is caught and its result is returned.
+
## Copyright
-Copyright (c) 2010-2017 Ivan Kuchin. See LICENSE.txt for details.
+Copyright (c) 2009-2017 Ivan Kuchin. See LICENSE.txt for details.