Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int eio_AfterConnect(eio_req *req) {
- printf("eio_AfterConnect; rc = %d\n", req->result);
- ev_unref(EV_DEFAULT_UC);
- }
- static int eio_Connect(eio_req *req) {
- // Note: this function is executed in the thread pool! CAREFUL
- int *foo = (int*)(req->data);
- printf("** %p\n", foo);
- // this should print 420 but segfaults instead
- printf("** %d\n", *(int*)(req->data));
- req->result = 666;
- return 0;
- }
- static Handle<Value> Connect(const Arguments& args) {
- HandleScope scope;
- int *foo = (int *) malloc(sizeof(int));
- *foo = 420;
- printf("foo is %d\n", *foo);
- eio_custom(eio_Connect, EIO_PRI_DEFAULT, eio_AfterConnect, foo);
- ev_ref(EV_DEFAULT_UC);
- return Undefined();
- }
Add Comment
Please, Sign In to add comment