Skip to content

Instantly share code, notes, and snippets.

View FranciscoMarinho's full-sized avatar

Francisco Marinho FranciscoMarinho

View GitHub Profile
@FranciscoMarinho
FranciscoMarinho / threadPool.js
Created January 2, 2018 12:02 — forked from pgjones/threadPool.js
Simple javascript thread pool example
ThreadPool = function(script, size) {
this.threads = [];
this.tasks = [];
for (var ithread = 0; ithread < size; ithread++) {
this.threads.push(new lxst.FilterThread(script, this));
}
};
ThreadPool.prototype.queueTask = function(task, callback) {
const task = {task: task, callback: callback};