webworker-threads
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -7,3 +7,3 @@ function fibo (n) { | ||
process.stdout.write(fibo(35).toString()); | ||
process.nextTick(fiboLoop); | ||
setImmediate(fiboLoop); | ||
})(); | ||
@@ -13,3 +13,3 @@ | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
@@ -20,3 +20,3 @@ function fibo (n) { | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
(function spinForever () { | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
@@ -15,3 +15,3 @@ function fibo (n) { | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
@@ -29,3 +29,3 @@ var numThreads= 10; | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
@@ -16,3 +16,3 @@ function fibo (n) { | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
@@ -17,3 +17,3 @@ var Worker = require('webworker-threads').Worker; | ||
process.stdout.write("."); | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); |
{ | ||
"name": "webworker-threads", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "description": "Lightweight Web Worker API implementation with native threads", |
@@ -57,3 +57,3 @@ # WebWorker Threads | ||
do spin = -> process.nextTick spin | ||
do spin = -> setImmediate spin | ||
``` | ||
@@ -65,3 +65,3 @@ | ||
Both the event loop and said listeners and callbacks run sequentially in a single thread of execution, Node's main thread. If any of them ever blocks, nothing else will happen for the duration of the block: no more events will be handled, no more callbacks nor listeners nor timeouts nor nextTick()ed functions will have the chance to run and do their job, because they won't be called by the blocked event loop, and the program will turn sluggish at best, or appear to be frozen and dead at worst. | ||
Both the event loop and said listeners and callbacks run sequentially in a single thread of execution, Node's main thread. If any of them ever blocks, nothing else will happen for the duration of the block: no more events will be handled, no more callbacks nor listeners nor timeouts nor setImmediate()ed functions will have the chance to run and do their job, because they won't be called by the blocked event loop, and the program will turn sluggish at best, or appear to be frozen and dead at worst. | ||
@@ -244,7 +244,7 @@ ### What is WebWorker-Threads | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); | ||
``` | ||
**B.-** Here's another program that adds to the one above a fibonacci(35) call in each turn, a CPU-bound task that takes quite a while to complete and that blocks the event loop making it spin slowly and clumsily. The point is simply to show that you can't put a job like that in the event loop because Node will stop performing properly when its event loop can't spin fast and freely due to a callback/listener/nextTick()ed function that's blocking. | ||
**B.-** Here's another program that adds to the one above a fibonacci(35) call in each turn, a CPU-bound task that takes quite a while to complete and that blocks the event loop making it spin slowly and clumsily. The point is simply to show that you can't put a job like that in the event loop because Node will stop performing properly when its event loop can't spin fast and freely due to a callback/listener/setImmediate()ed function that's blocking. | ||
@@ -260,7 +260,7 @@ cat examples/quickIntro_blocking.js | ||
process.stdout.write(fibo(35).toString()); | ||
process.nextTick(fiboLoop); | ||
setImmediate(fiboLoop); | ||
})(); | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); | ||
@@ -288,3 +288,4 @@ ``` | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
process.stdout.write("."); | ||
setImmediate(spinForever); | ||
})(); | ||
@@ -316,3 +317,3 @@ ``` | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); | ||
@@ -339,3 +340,3 @@ ``` | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); | ||
@@ -375,3 +376,3 @@ ``` | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); | ||
@@ -412,3 +413,3 @@ ``` | ||
(function spinForever () { | ||
process.nextTick(spinForever); | ||
setImmediate(spinForever); | ||
})(); | ||
@@ -415,0 +416,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
470
252950