File tree Expand file tree Collapse file tree 9 files changed +10
-10
lines changed
Expand file tree Collapse file tree 9 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44const { Worker } = threads ;
55
66const getInheritance = ( instance , parents = [ ] ) => {
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44const { Worker } = threads ;
55
66console . dir ( { master : threads } ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44
55console . dir ( { worker : threads } ) ;
66threads . parentPort . postMessage ( 'Message from Worker to Master' ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
4- const http = require ( 'http' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
4+ const http = require ( 'node: http' ) ;
55
66const port = 8000 ;
77
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44const { Worker } = threads ;
55
66const worker = new Worker ( './3-http.js' ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44
55const { buffer } = threads . workerData ;
66const array = new Int8Array ( buffer ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44const { Worker } = threads ;
55
66const buffer = new SharedArrayBuffer ( 1024 ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44
55const { buffer } = threads . workerData ;
66const array = new Int8Array ( buffer ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const threads = require ( 'worker_threads' ) ;
3+ const threads = require ( 'node: worker_threads' ) ;
44const { Worker } = threads ;
55
66const buffer = new SharedArrayBuffer ( 1024 ) ;
You can’t perform that action at this time.
0 commit comments