If you receive a message in the DebuggerAgent and your main thread is
not immediately executing javascript but idling in select(), how can
you give control back to V8 to handle the message? It seems there
should be some way to poll the agent to handle received messages.
Am I correct in my reading that the while(true) loop body in
Debugger::NotifyMessageHandler() would be such a poll function if the
Wait()s were removed?
ry
Is it possible to be notified (via callback) outside of my main thread
(from the DebuggerAgent thread) about received messages? I would like
to use such a callback to write a byte to a pipe to wake up my
select(), this would avoid polling every 100 ms.
Thank you, ry
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