ybogdanov / node-sync

Write simple and readable synchronous code in nodejs using fibers
MIT License
492 stars 70 forks source link

Fiber never returns to the main thread #37

Closed raeesaa closed 10 years ago

raeesaa commented 10 years ago

Hi. I am calling an asynchronous function from fiber as,

Sync(function() {
        var result = work.insertWorks.sync(null, param1, param2);
        console.log(result);
});

The result is logged correctly onto console but my program never returns to the main thread. The code below fiber is never executed. I haven't used node-fibers before, therefore I am not sure if I have missed something.

ybogdanov commented 10 years ago

Hi, what you mean by "the main thread"? Could you give an example of what not being executed?

raeesaa commented 10 years ago
Sync(function() {
        var result = work.insertWorks.sync(null, param1, param2);
        console.log(result);
});

console.log('The code written here was not getting executed!');

There was some issue with my code I guess, the lines of codes after fiber are getting executed now. Thanks for a great library.