Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactored yield() to Fiber.yield(), bumped node-fibers version, upda…

…ted readme.md
  • Loading branch information...
commit b21d2ebc8ab601ccfc2d138717660f71ce9dca86 1 parent 7761834
@ybogdanov authored
Showing with 9 additions and 7 deletions.
  1. +1 −0  .gitignore
  2. +3 −2 README.md
  3. +4 −4 lib/sync.js
  4. +1 −1  package.json
View
1  .gitignore
@@ -0,0 +1 @@
+node_modules
View
5 README.md
@@ -116,7 +116,8 @@ Transparent integration
Parallel execution:
- var Sync = require('sync');
+ var Sync = require('sync'),
+ Future = Sync.Future();
// Run in a fiber
Sync(function(){
@@ -137,7 +138,7 @@ Parallel execution:
// Or you can straightly use Sync.Future without wrapper
// This call doesn't blocks
- asyncFunction(2, 3, foo = new Sync.Future());
+ asyncFunction(2, 3, foo = Future());
// foo is a ticket
console.log(foo); // { [Function: Future] result: [Getter], error: [Getter] }
View
8 lib/sync.js
@@ -57,7 +57,7 @@ Function.prototype.sync = function(obj /* arguments */) {
fn.apply(obj || null, args);
// wait for result
- while (!cb_args) yield();
+ while (!cb_args) Fiber.yield();
// err returned as first argument
var err = cb_args.shift();
@@ -203,7 +203,7 @@ function SyncFuture(timeout)
self.ticket(self.timeoutError);
}, self.timeout)
}
- yield();
+ Fiber.yield();
}
if (self._error) throw self._error;
return self._result;
@@ -335,7 +335,7 @@ Sync.Parallel = function SyncParallel(fn)
}
fn(callback);
- while (i > 0) yield();
+ while (i > 0) Fiber.yield();
return result;
}
@@ -354,7 +354,7 @@ Sync.sleep = function(ms)
fiber.run();
}, ms);
- yield();
+ Fiber.yield();
}
module.exports = exports = Sync;
View
2  package.json
@@ -9,6 +9,6 @@
"node": ">=0.3.6"
},
"dependencies" : {
- "fibers": ">=0.2.3"
+ "fibers": ">=0.2.6"
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.