[kepler-dev] Re: sampling

Edward A Lee eal at eecs.berkeley.edu
Thu May 27 07:46:23 PDT 2004


At 10:55 AM 5/26/2004 -0700, Chad Berkley wrote:
>I've been tossing this idea of stopping the execution to ask for input 
>around in my head since the SEV meeting.  I haven't really come up with a 
>good solution other than writing an extension to the pause actor that 
>allows an input dialog to be popped up.  How to configure that dialog or 
>get the actual information you need is a tough question since I'd like to 
>make it generic enough to work with workflows other than GARP.
>Edward or Christopher, do you have any examples of workflows that stop 
>execution and ask users for input then continue executing based on that 
>input?  I haven't seen any.  Does anyone have any good ideas on how this 
>could be done generically?

The Ptolemnizer demo under "Quick tour," "complete list of demos," and
"SDF," uses the InteractiveShell actor, which waits for user input
before continuing.

There is a major difficulty with writing actors that have UI components:
Swing, regrettably, is not a thread-safe UI.  Sun tried to make it
one initially, but they gave up.  Any UI actions need to be executed
in the Swing event thread (see SwingUtilities.invokeLater()).  The
problem is that actors are executed in another thread.  In PN, things
are relatively easy, because each actor has its own thread, so you
can use SwingUtilities.invokeAndWait() without (much) risk of deadlock.
But if you try this in any other domain, you _will_ get deadlock...
The symptom will be that at seemingly random times, the whole UI
will hang...

The InteractiveShell actor implementation works out this issue,
but it's surprisingly subtle...

It would be very nice to have a generalization of the InteractiveShell
that could open an arbitrarily structured GUI interface, with check
boxes and the like... E.g., something that builds on the ptolemy.gui.Query
class...

Another question is, do you really want to do this?  I personally
find it very annoying when I start a program, go get some coffee,
and find that it stopped just after I left to ask me a question
like "Are you sure you want to do this?"  As a result, it made
no progress while I was gone...  I would use these sorts of dialogs
very sparingly...

Edward




------------
Edward A. Lee, Professor
518 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0455, fax: 510-642-2739
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal




More information about the Kepler-dev mailing list