repositories
/
poolifier.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Provide a cluster worker pool (#92)
[poolifier.git]
/
benchmarks
/
external
/
workerThreadsWorker.js
1
const
{
isMainThread
,
parentPort
} =
require
(
'worker_threads'
)
2
3
if
(!
isMainThread
) {
4
for
(
let
i
=
0
;
i
<=
1000
;
i
++) {
5
const
o
= {
6
a
:
i
7
}
8
JSON
.
stringify
(
o
)
9
}
10
// console.log('This is the main thread ' + isMainThread)
11
parentPort
.
postMessage
({
ok
:
1
})
12
}