Hi Ryan,
After our discussion yesterday I have been working on a similar patch using
an additional debugger API
function SetDebugMessageDispatchHandler(DebugMessageDispatchHandler handler)
instead of an additional parameter to EnableAgent, as it might be useful
when not using the agent. I don't think the Poll() API is required as using
option --debugger-auto-break and calling an empty JavaScript function should
work the same. However this callback needs to be handled with care as it
should not be used to enter V8 when receiving messages for processing in an
active break. In your setting where you will just ensure the main thread is
no longer sitting in select() it should be fine though.

You are most welcome to continue working on this as it will be easier for
you to test it in a real application. Adding a test to test-debug.cc which
checks that the callback is called when enabled is a good thing as well.

I have attached my patch which mainly differs in the naming.

Regards,
Søren

On Thu, Oct 8, 2009 at 13:51, Ryan Dahl <[email protected]> wrote:

> Hi Søren,
>
> I'm began a little patch to give such a wake-up callback (attached).
> Is this something you all would accept?
>
> It adds a new public function v8::Debug::Poll() which is to be called
> from the main thread occasionally. It also adds an optional third
> argument to v8::Debug::EnableAgent() which is a callback. The callback
> (called "WantPollHandler") is executed from the Agent thread. The user
> can use that callback to wake up the main thread to enter V8 (by
> calling Poll()).
>
> The patch currently untested, but I can probably put a unit test
> together using the Semaphore's Signal() and Wait()
>
> ry
>
> >
>

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

Attachment: msg_dispatch.patch
Description: Binary data

Reply via email to