Hi Heinrich, Actually Node.js is not multithreaded, I would suggest you to read this good article on the event driven architecture: https://nodesource.com/blog/understanding-the-nodejs-event-loop So currently, this Node.js binding don't have to be threadsafe.
The big next step is to make MIP solver async, and you right there will be a thread-safety problem, and I will have to make some internal changes to GLPK. About the error hook function, I missed this point, and I will make an update ASAP. Best regards Le 28/05/2015 06:34, Heinrich Schuchardt a écrit : > Hello Henri, > > GLPK is not thread safe. Node.js uses multiple threads from a thread > pool to serve multiple requests. You should provide a locking mechanism. > > Furthermore GLPK-calls may need several minutes to return. So in Node.js > GLPK should be called asynchronously like a slow IO. > > If an error occurs in GLPK it will terminate the complete process. You > should provide an error hook function to handle errors gracefully. > Otherwise the whole Node.js server will go down in an error situation. > > Best regards > > Heinrich Schuchardt > > > > > Henri Gourvest <hgourv...@progdigy.com>schrieb: > > Hi, > > This is a native module for GLPK. > You now can run GLPK on server side, or just make scripts. > Working on Windows, Linux and Mac. > It is also a good opportunity to create a crossplatform IDE using > node-webkit. > > https://github.com/hgourvest/node-glpk > > *Install* > > npm install glpk > > *Example* > > var glp = require("glpk"); > var prob = new glp.Problem(); > prob.readLp("todd.lpt"); > prob.scale(glp.SF_AUTO); > prob.simplex({presolve: glp.ON}); > if (prob.getNumInt() > 0){ > function callback(tree){ > if (tree.reason() == glp.IBINGO){ > // ... > } > } > prob.intopt({cbFunc: callback}); > } > prob.delete(); > > > _______________________________________________ > Help-glpk mailing list > Help-glpk@gnu.org > https://lists.gnu.org/mailman/listinfo/help-glpk > > > > _______________________________________________ > Help-glpk mailing list > Help-glpk@gnu.org > https://lists.gnu.org/mailman/listinfo/help-glpk > _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk