octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Race condition seems to be fixed


From: Michael Goffioul
Subject: Re: Race condition seems to be fixed
Date: Tue, 22 May 2012 12:46:09 +0100

On Tue, May 22, 2012 at 12:35 PM, Jacob Dawid <address@hidden> wrote:
Still crashes. The problem with that hook is that it is non-blocking, so I cannot be sure that the symbol_table is valid during the time I update the GUI model. So this doesn't help the race condition issue.


2012/5/22 Jacob Dawid <address@hidden>
After debugging, apparently, the readline hook is being called multiple times even when the previous run is not finished. Probably adding a semaphore will help that.


2012/5/22 Jacob Dawid <address@hidden>
Or use command_editor::add_event_hook(). It's lighter than using the interpreter...

Michael.


Okay, I did that. Adding a hook works as long as the symbol table is small. When adding 1000 symbols it crashes the GUI randomly.


AFAIK readline even hooks are blocking, as long as the hook is executing. What is probably happening is that you're executing some code in another thread than the main thread (where readline is executing), then it is possible readline triggers a new run of the hook while your code is still executing in the other thread. It's up to you to make your code safe.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]