All Downloads are FREE. Search and download functionalities are using the official Maven repository.

highlevelidioms.whileblocking.js Maven / Gradle / Ivy

Go to download

Provides runtime and analysis for behavioral programs written in JavaScript. It can run stand-alone (from the commmandline) or be embedded in larger JVM-based systems.

The newest version!
/* global bsync, blocking */

var _bsync = bsync;

new Object {
  blocking: new EventStack(),

  whileBlocking: function(blocked, f) {
    try {
      blocking.push(blocked);
      f();
      return blocking.pop();
    } catch (thrownEvent) {
      blocking.pop();
      throw thrownEvent;
    }
  },

  bsync: function(requested, wait, blocked) {
    var e;
    if (!this.blocking.isEmpty()) {
      var eset = new EventSet([blocked, this.blocking]);
      e = _bsync(requested, wait, eset);
    } else {
      e = _bsync(requested, wait, blocked);
    }

    return e;
  }
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy