Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML class YourClass1 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 af = AsyncFu. new ( YourClass1 .new) af. hello
Copy Source | Copy HTML
- 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
Copy Source | Copy HTML
- require 'rubygems'
- require 'async_fu'
- class some
- def grep (query, path)
- list = ` grep -rne '# {query}' # {path}`
- File . new ( '/tmp/grep.log' , 'w' ) .write list
- end
- def tick
- loop {
- sleep 1
- p 'tick'
- }
- end
- def tack
- loop {
- sleep 2
- p 'tack'
- }
- end
- end
- test = AsyncFu. new ( Some .new)
- test. tick
- test. grep ( 'thread.rb' , '/ usr / local / lib' )
- test. tack
Source: https://habr.com/ru/post/53692/
All Articles