Skip to content

Commit

Permalink
Use occupied instead of waiting.
Browse files Browse the repository at this point in the history
  • Loading branch information
flatheadmill committed Jul 15, 2016
1 parent 42b831a commit 9cc0eed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vestibule.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ var slice = [].slice

function Vestibule () {
this._waiting = []
this.waiting = 0
this.occupied = false
this.open = null
}

Vestibule.prototype.enter = function (callback) {
if (this.open == null) {
var cookie = {}
this.waiting++
this.occupied = true
this._waiting.push({
cookie: cookie,
callback: callback
Expand All @@ -32,7 +32,7 @@ Vestibule.prototype.leave = function (cookie) {

Vestibule.prototype.notify = function () {
var vargs = slice.call(arguments)
this.waiting = 0
this.occupied = false
this._waiting.splice(0, this._waiting.length).forEach(function (waiting) {
waiting.callback.apply(null, vargs)
})
Expand Down

0 comments on commit 9cc0eed

Please sign in to comment.