Sha256: dad987e7fd13f36833829cb602e19eb0b95691d723919b477311c269d5a37716
Contents?: true
Size: 1.04 KB
Versions: 6
Compression:
Stored size: 1.04 KB
Contents
= async-fu async-fu improve your code with abilities to run long task in threaded way == Examples === Simple usage class YourClass1 def hello p 'incapsulated test' p 'start' p 'list ' + Thread.list.join( ' ') p 'main ' + Thread.main.to_s p 'this ' + Thread.current.to_s p 'end' end end af = AsyncFu.new(YourClass1.new) af.hello === Interitence usage class YourClass2 < AsyncFu def hello p 'start' p 'list ' + Thread.list.join( ' ') p 'main ' + Thread.main.to_s p 'this ' + Thread.current.to_s p 'end' end end ai = YourClass2.new ai.hello === Thread exit solution You do not need more to use join method to lock threads, if you not use it for some reasons. AsyncFu catch exit of ruby program and check for live threads pass main thread until they ended. If you don't need this futures, you can switch it off by using exit method of AsyncFu class. == TODO === 1.x.x * callbacks === 2.x.x * add mixin style YourClass include async-fu end == Copyright Copyright (c) 2009 Amir Mamedov. See LICENSE for details.
Version data entries
6 entries across 5 versions & 1 rubygems