Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
laverdet committed Jan 16, 2011
0 parents commit 906b73a
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 0 deletions.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright 2011 Marcel Laverdet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I am providing code in this repository to you under an open source license.
Because this is my personal repository, the license you receive to my code is
from me and not from my employer (Facebook).
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
NODE_PREFIX := $(shell node --vars | egrep ^NODE_PREFIX: | cut -c14-)
# CPPFLAGS = -ggdb -O0 -Wall -I$(NODE_PREFIX)/include -I$(NODE_PREFIX)/include/node -I/Users/marcel/code/v8/include
CPPFLAGS = -m64 -ggdb -O0 -Wall -I$(NODE_PREFIX)/include -I$(NODE_PREFIX)/include/node

all: node-fibers.node

coroutine.dylib: coroutine.cc
$(CXX) $(CPPFLAGS) -dynamiclib -o $@ $^

node-fibers.node: node-fibers.cc coroutine.dylib
$(CXX) $(CPPFLAGS) -bundle -undefined dynamic_lookup -o $@ $^

clean:
-$(RM) node-fibers.node coroutine.dylib
-$(RM) -r *.dSYM
37 changes: 37 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Fiber support for Node and v8.

To build this software:

make

Only OS X is supported right now.

If you intend to use fibers, be sure to start node with the included
`fiber-shim` script. This is a quick example of what you can do with
node-fibers:

$ cat generator.js
var util = require('util');
var Fiber = require('./node-fibers').Fiber;

var inc = Fiber(function(start) {
var total = start;
while (true) {
total += this.yield(total);
}
});

for (var ii = inc.run(1); ii < 10; ii = inc.run(1)) {
util.print(ii + '\n');
}

$ ./fiber-shim node generator.js
1
2
3
4
5
6
7
8
9
Loading

0 comments on commit 906b73a

Please sign in to comment.