|
From: | Daniel J Sebald |
Subject: | Re: GUI release date approaches |
Date: | Tue, 11 Jun 2013 16:32:41 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 06/11/2013 04:09 PM, John Swensen wrote:
The very old octave_server class that I used in OctaveDE used a synchronous interaction between the GUI and the octave core during the readline idle loop to query specific variables. Essentially the GUI would maintain a list of mutex-protected requested variable names and Octave would read it and push a copy of the variable back through a mutex-protected list of variables. I know this kindof goes against the new asynchronous paradigm for GUI/Octave interaction that has come with the QT GUI, but it made for an easy way to retrieve things like this for tooltips. And because the idle loop is many time per second and only runs when not executing code, it was fairly efficient also. The GUI, then, just had to be smart about what and when it was requesting a full variable.
Your approach isn't very much different from what I eventually did with the background command. The background command was patterned on what JWE did with the callbacks and that too does processing only when there is idle time. The mutex-protected portion seems essential. What I had done is signal the result from Octave core to the GUI via pointer then use a mutex to put the Octave core into a sleep state so that the GUI can utilize the data momentarily then awake the worker process. The advantage of the command approach is that it can be used for anything from manipulating breakpoints to modifying data.
One other thing I remember is adding the actual command to the result because the GUI uses signal/slots and there can be multiple commands queued. The actual command helps to clarify what widget requested the info.
Dan
[Prev in Thread] | Current Thread | [Next in Thread] |