Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more sane example

  • Loading branch information...
commit 5d212fad313873b5b8aff17ebff8b065060d2533 1 parent a9f869e
Peteris Krumins authored
Showing with 5 additions and 5 deletions.
  1. +4 −4 async.cpp
  2. +1 −1  tests/a.js
8 async.cpp
View
@@ -35,7 +35,7 @@ class Async : public ObjectWrap {
struct moo_request {
Persistent<Function> cb;
Async *async;
- int x, y;
+ int result;
};
static int EIO_Moo(eio_req *req) {
@@ -44,8 +44,8 @@ class Async : public ObjectWrap {
//
printf("%x %x\n", req, req->data);
moo_request *moo_req = (moo_request *)req->data;
- moo_req->x = 11;
- moo_req->y = 4;
+ Async *async = moo_req->async;
+ moo_req->result = async->x * async->y;
return 0;
}
@@ -56,7 +56,7 @@ class Async : public ObjectWrap {
moo_request *moo_req = (moo_request *)req->data;
Local<Value> argv[1];
- argv[0] = Integer::New(moo_req->x * moo_req->y);
+ argv[0] = Integer::New(moo_req->result);
TryCatch try_catch;
2  tests/a.js
View
@@ -1,6 +1,6 @@
var Async = require('../async').Async;
-var async = new Async(1,2);
+var async = new Async(11,4);
async.moo(function (x) {
console.log(x);
Please sign in to comment.
Something went wrong with that request. Please try again.