You should post the contents of sync1(), you might be missing something.

Try replacing sync1() with a fs.readFileSync("someFile.txt"); and see if
you get the same result.

I suspect that sync1() is doing something that you might be overlooking.



On Sat, Feb 25, 2012 at 12:09 PM, Vyacheslav Egorov <[email protected]>wrote:

> Neither is true. V8 is reentrant that is from JS you can call C++ code
> that would call JS code again immediately. V8 also has preemption mode in
> which V8 switches between several JS 'threads' (nodejs does not use this
> mode though) pausing and restarting them.
>
> Vyacheslav Egorov
> On Feb 25, 2012 4:53 PM, "mscdex" <[email protected]> wrote:
>
>> On Feb 25, 10:47 am, Rambo <[email protected]> wrote:
>> > Could the event loop execute a callback added as an event listener
>> between
>> > sync1 and sync2 call? if so, when does sync2 get executed, before or
>> after
>> > the callback?
>>
>> No, the v8 vm is not re-entrant and is non-interruptible, so nothing
>> else will happen between sync1() and sync2().
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to