No problem.  One caveat.  TJ's code does not take into account the
setInterval( interval, "someJSCode();" ); case.  A simple fix, so I
wrote my code (based on ideas from his code) to take that into
account.  Mix in gettimeofday() and usleep() in the loop, and you can
achieve ~5-10us task switching on a C2Q Q8400.

-L

On Wed, Apr 7, 2010 at 10:07 AM, Stephan Beal <[email protected]> wrote:
> On Wed, Apr 7, 2010 at 7:03 PM, Louis Santillan <[email protected]> wrote:
>>
>> I prefer this JS based implementation
>> (http://github.com/visionmedia/js-mock-timers).  Much simpler and only
>> requires wiring up a time source (the library uses a tick() method for
>> this).  It's simple enough to be rewritten to use a usleep() based
>> call in a pseudo event loop.
>
> HOLY COW! That's great!!! Now i can go delete my impl altogether (or rename
> it to startThread()). i have a sleep()/mssleep()/usleep() bindings for v8,
> so it sounds like it'd be trivial to re-use the mock timers. Doh, but my
> sleep impls explicitly Unlock during the native-level sleep to allow other
> threads to run, so i might run into problems again there. Time to go hack...
> Thanks for that :).
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
>
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

To unsubscribe, reply using "remove me" as the subject.

Reply via email to