help-octave
[Top][All Lists]
Advanced

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

Re: Catching Figure close button - callbacks not running?


From: pavel
Subject: Re: Catching Figure close button - callbacks not running?
Date: Tue, 29 Jan 2019 21:02:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1


I *think* the callbacks are run when the event occurs.  That is consistent with 
my experience anyway. It's just that the figure window is not updated until 
drawnow() is run.

That would be great news since multithreading would be provided. Unfortunately until I call drawnow(), the callback does not run in my case (it creates some files so easy to check). I have a bit hard time understanding the documentation in detail


========
By default callback functions are queued (they are executed one after the other in the event queue) unless the drawnow, figure, waitfor, getframe, or pause functions are used. If an executing callback invokes one of those functions, it causes Octave to flush the event queue, which results in the executing callback being interrupted.
========

It does not say whether the queue waits for execution or is executed right away in a separate thread. But what I see it seems to run in the main thread - my loop waits until drawnow finishes with the callback.



It looks as if the onCleanup() function ('help onCleanup') may allow you to 
hook Ctrl+C.  Not sure though, I haven't tried it myself.


Thanks for the hint. Just Ctrl+C stops the execution right away, no room to clear some specific variable to invoke the cleanup. Or maybe I just do not undertstand the use properly.

Thanks a lot!

Pavel.



reply via email to

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