Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

barrier-basic.js 552B

1234567891011121314151617181920212223242526272829
  1. var mod_vasync = require('../lib/vasync');
  2. var barrier = mod_vasync.barrier();
  3. barrier.on('drain', function () {
  4. console.log('barrier drained!');
  5. });
  6. console.log('barrier', barrier);
  7. barrier.start('op1');
  8. console.log('op1 started', barrier);
  9. barrier.start('op2');
  10. console.log('op2 started', barrier);
  11. barrier.done('op2');
  12. console.log('op2 done', barrier);
  13. barrier.done('op1');
  14. console.log('op1 done', barrier);
  15. barrier.start('op3');
  16. console.log('op3 started');
  17. setTimeout(function () {
  18. barrier.done('op3');
  19. console.log('op3 done');
  20. }, 10);