I've been looking at the source code and there's a function that looks like it would help me out.
Logger::EnsureTickerStarted(). It contains the line: if (!ticker_->IsActive()) ticker_->Start() It does not work because all the internal data structures related to the context are cloned by fork(). I'd like to see the code modified so it keeps the PID of the process that successfully starts the Ticker in the internal data structure when the thread is started. If this function is called and the current PID doesn't match the internal data structure one, then start the ticker thread and fix up the bookkeeping members in the internal structures. Please? On Wednesday, March 7, 2012 8:27:00 AM UTC-8, mschwartz wrote: > > My main program (C++) creates context, global object, loads a .js file, > creates a new v8::Script, and runs it. > > The JavaScript code does a call to an exposed function in the global > object, fork(), which calls the OS' fork function and returns its return > value. > > The fork() call works as expected - I have a parent and child process, > each continues running in the JavaScript context from where fork() returns. > > However, there are two issues I'd like some help with. > > First, there is a tick thread in the parent process that JIT optimizes the > JS code as it executes. After fork(), this is not running in the child > process' space. In fact, all the v8 internal (and private) variables are > cloned by fork() so v8 actually thinks there is a tick thread running. > What I'm looking for is a way to modify my fork() C++ code to do the > fork() an start up the tick thread before returning. Any clues on how to > do this? Remember, v8's internal variables tell it the thread is running > even though it isn't. > > Second, when I enable the debugger, the client apps (like d8) can connect > to the program and do some of the commands, but it stops working after a > bit. I'm not entirely sure what's going on here, but my guess is that the > cloned (by fork) contexts think they're one and not many and this confuses > the debugger logic. Or maybe it's that I'm doing the > SetDebugMessageDispatchHandler > logic in the parent process? Any clues here would be greatly appreciated. > > Thanks in advance. > > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
