function-thread
Advanced tools
Comparing version 0.2.2 to 0.2.3
'use strict'; | ||
var os = require('os'); | ||
@@ -8,3 +7,2 @@ var _ = require('lodash'); | ||
var genericPool = require('generic-pool'); | ||
/** | ||
@@ -47,3 +45,2 @@ * @param {Function} func | ||
}, options || {}); | ||
if (options.usePool) { | ||
@@ -66,3 +63,2 @@ var pool = genericPool.createPool({ | ||
}, options.pool); | ||
return function (input) { | ||
@@ -87,3 +83,2 @@ return pool.acquire().then(function(thread) { | ||
} | ||
return function (input) { | ||
@@ -90,0 +85,0 @@ var thread = spawn(func); |
{ | ||
"name": "function-thread", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Run the function in a separate thread", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,4 +1,8 @@ | ||
'use strict'; | ||
var childProcess = require('child_process'); | ||
var path = require('path'); | ||
/** | ||
* @param func | ||
* @returns {ChildProcess} | ||
*/ | ||
module.exports = function (func) { | ||
@@ -5,0 +9,0 @@ var thread = childProcess.fork(path.join(__dirname, 'worker.js')); |
10906
179