Skip to content

Instantly share code, notes, and snippets.

@nowelium
nowelium / latch.js
Created January 13, 2012 03:05
CountdownLatch
var CountdownLatch = function (limit){
this.limit = limit;
this.count = 0;
this.waitBlock = function (){};
};
CountdownLatch.prototype.countDown = function (){
this.count = this.count + 1;
if(this.limit <= this.count){
return this.waitBlock();
}