Enrico Forestieri wrote:
On Tue, Jan 15, 2008 at 08:24:54AM +0100, Abdelrazak Younes wrote:
rgheck wrote:
Attached is an updated version of this patch---updated for safety, basically. Instead of having a global variable LyX::IAmAChild, I've put a static private variable in ForkedProcess, where it can be read and written by the fork() routine, and then read via a static function. That way, nothing else can mess with it.

I'll commit Tuesday unless there are any concerns.
I think it is a good temporary solution but as I said in my other reply I don't think this will scale to multiple child processes running at the same time.

Why?

I was puzzled by this, too, but reading Abdel's code, I think he was thinking more in terms of threads than in terms of processes, and so not seeing that each process has its own memory space.

That said, and on a slightly different topic, I think implementing a fork for the LaTeX stuff wouldn't be hard if we could rely upon shared memory to pass back the error list. Is this hard to do? or is it trivial if the child process keeps a pointer to that structure? Presumably, this structure needs to be dynamically allocated, and the pointer should be a shared pointer, so the memory won't be released in case the parent should happen to die before the child. (I see warnings about this too in the ForkedProcess code.) And then when the child is done, it signals the parent, and the parent can look at the error list, etc.

I mention all of this only because it is SUCH a common user request. To be sure, there are other issues: It'll be very hard to match the errors with locations in the LyX file if the LyX file has changed. But then, an option would be to retain a copy of that buffer in memory, and then display it, with the errors tagged to it, if indeed there are errors. OK, so maybe that's not trivial. But it doesn't sound terribly impossible. Or are there other issues I'm missing?

Richard


Reply via email to