[kepler-dev] Can "stop" interrupt "initialize()"

Edward A. Lee eal at eecs.berkeley.edu
Mon Jan 30 14:56:57 PST 2006


At 01:49 PM 1/30/2006 -0600, Kevin Ruland wrote:

>>Every Director has a method isStopRequested().
>>A long running initialize() method should just call this method
>>and abort if it returns true...
>
>I think I can use this in some kind of spin wait.  What's the easiest way 
>for an actor get a handle to it's director?

  Call getDirector().
  I wouldn't do this as a spin wait, though. Instead,
  in the long running thread, periodically call isStopRequested() at
  points where it would be safe to abort.  This is much safer than
  calling interrupt() on a thread, which can leave objects in an
  undefined state.

>I did a little digging and noticed that Manager.finish() does a 
>notifyAll().  Presumably I could tap into this as well and synchronize on 
>the Manager object.  Of course, I need to get my hands on the Manager, and 
>there might be a different deadlock situation present.

  getManager().

Edward



------------
Edward A. Lee
Professor, Chair of the EE Division, Associate Chair of EECS
231 Cory Hall, UC Berkeley, Berkeley, CA 94720
phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal  



More information about the Kepler-dev mailing list