1.1.0 • Published 8 years ago

uncomplicated-pool v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

pool

Simple pool for asynchronous tasks

uncomplicated-pool(size)

initialises a pool of the given size;

pool(x)

the passed function waits on the pool

pool()

call when something leaves the pool

Example

var pool = require('uncomplicated-pool');

var size = 8; // I'm on an eight core machine?

var actions = 200;

var my_pool, action;

// Define the pool
my_pool = pool(size);

function my_action(example, parameters, cb) {
  // Some asynchronous action (e.g. running a c program)
  cb();
}

while(actions--) {
  // Ensure that the pool is left at the completion of an action
  action = function() {
    my_action("Example", "parameters", my_pool);
  }
  
  // Add the action to the pool
  my_pool(action);
}
1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago