1 | #!/usr/bin/env coffee
|
2 | require('coffee-script').register()
|
3 | bobbin = require '../src/bobbin.coffee'
|
4 |
|
5 | pool = bobbin.create()
|
6 |
|
7 | work = (i, cb) ->
|
8 | foo = 0.5
|
9 |
|
10 | #console.log 'working...'
|
11 |
|
12 | for j in [1..10000]
|
13 | foo += Math.random()
|
14 | foo /= 2
|
15 |
|
16 | cb null, i
|
17 |
|
18 | log_result = (err, result) -> console.log(result)
|
19 |
|
20 | pool.run(i, work, log_result) for i in [1..20]
|