GithubHelp home page GithubHelp logo

inh3 / npool Goto Github PK

View Code? Open in Web Editor NEW
109.0 9.0 15.0 671 KB

A cross-platform thread pool add-on for Node.js and io.js.

License: Other

Makefile 0.03% JavaScript 60.38% Python 0.96% C++ 24.37% C 14.26%

npool's Issues

Unable to install on Windows - error C2440: 'function' : cannot convert from 'THREAD_FUNC (__cdecl *)(void *)' to 'unsigned int (__stdcall *)(void *)'

I get the following error when trying to install on Windows 8. Any suggestions appreciated!

E:\myproject>npm install npool
npm WARN package.json [email protected] No repository field.
npm http GET https://registry.npmjs.org/npool
npm http 304 https://registry.npmjs.org/npool

> [email protected] install E:\myproject\node_modules\npool
> node-gyp rebuild


E:\myproject\node_modules\npool>node "E:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  thread_pool.c
  task_queue.c
  synchronize.c
..\threadpool\synchronize.c(65): error C2440: 'function' : cannot convert from 'THREAD_FUNC (__cdecl *)(void *)' to 'unsigned int (__stdcall *)(void *)' 
[E:\myproject\node_modules\npool\build\threadpool.vcxproj]
..\threadpool\synchronize.c(65): warning C4024: '_beginthreadex' : different types for formal and actual parameter 3 [E:\myproject\node_modules\npool\build\threadpool.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "E:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\myproject\node_modules\npool
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

E:\myproject>

require an installed node module

Apparently it's not possible to load an installed module from within a work unit.
Here below an example, just to give an idea:

main file:

var nPool = require('npool');

nPool.loadFile(1, __dirname + '/test.js');
nPool.createThreadPool(20);

var unitOfWork = {
    workId:           uniqID(),
    fileKey:          1,
    workFunction:     "run",
    workParam:        {},
    callbackFunction: callbackFunction,
    callbackContext:  funcion () {}
};

// queue the unit of work
nPool.queueWork(unitOfWork);

test.js

var fs = require('fs');

This is the error generated:

{ message: 'Uncaught Error: Require::RequireFunction - File Name is invalid: fs',
  resourceName: 'test.js',
  lineNum: 1,
  sourceLine: 'var fs = require(\'fs\'),',
  stackTrace: 'Error: Require::RequireFunction - File Name is invalid: fs\n    at test.js:1:10' }

Is there any known workaround until the problem will be fixed?

Thank you

Node >= 0.11.x support?

I'm sure you have a lot on your plate and that it's not necessary a quick change, but I was wondering if there was any plans for supporting node > 0.10.x ?

I'd like to help if I can at some point, but I have to brush up on my C/C++ first :)

Code load support

Is it possiable to load code not only from file but

  1. from strings, like pool.loadString('function () {}');
  2. from defined functions, like pool.loadFunction(function () {}) (by function.toString() method maybe)

Thanks for your work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.