Skip to content

DoubleSpout/nodeLibuvThread

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodeLibuvThread Build Status NPM version

node multi thread support using libuv.

Installing the module

With npm:

libuv_thread module is supported windows, linux, mac.

Make sure, node-gyp has installed.

 npm install libuv_thread

From source:

 git clone https://github.com/DoubleSpout/nodeLibuvThread.git
 cd libuv_thread
 node-gyp rebuild

To include the module in your project:

 var libuv_thread = require('libuv_thread');

##Simple Example:

var thread = require('../');
var threadFunc = function(obj){
	return ++obj.count;
}
thread(threadFunc, {count:0}, function(err,count){
	if(err) return console.log(err);
	console.log(count);//this will print 1
})

##Api:

libuv_thread(func, obj, callback);

func: thread work function

obj: arguments for the thread funtion

callback:has two arguments,error and result,the result will be thread work return value

About

nodeLibuvThread

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published