octave-maintainers
[Top][All Lists]
Advanced

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

Re: using timers in the GUI (was: Re: Testing MXE-Octave)


From: Jacob Dawid
Subject: Re: using timers in the GUI (was: Re: Testing MXE-Octave)
Date: Mon, 18 Feb 2013 19:03:10 +0100
User-agent: Roundcube Webmail/0.6

Yeah, I don't understand the point of the timer either.  Wouldn't it
be sufficient to just perform the update when the Octave interpreter
is at points where it is safe to perform updates? For example, in the
readline callback when Octave is waiting for input and perhaps some
other select locations.  Jacob, could you comment about why you chose
to use a timer for this purpose?

That's pretty complicated.

As far as I recall, the problem was that Qt's model/view mechanism is not - different from what I initially supposed - threadsafe. The updating of the model has to be done from within the Qt thread. As I experienced crashes because of that, I sequenced the access to a specific "intermediate" memory by semaphores (basically just a simplified version of a symbol list). The octave symbol table is queried and the intermediate memory updated whenever the interpreter is ready and the intermediate memory is *not read* by the Qt thread (otherwise it would wait for the Qt thread to finish its job). At times, where the octave interpreter is not accessing the intermediate memory (ie. writing), the Qt thread periodically updates the model based on the intermediate memory. Since there is no guarantee that the procedure invoked by the timer will be finished within an interval, the timer is a single shot timer. It will only fire once, then the timer is restarted by the procedure when the model has been fully updated. That guarantees idle times between updates.




reply via email to

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