home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / INPUT / WORK_PRO.JAV < prev   
Encoding:
Text File  |  1996-10-04  |  2.6 KB  |  62 lines

  1. package sub_arctic.input;
  2.  
  3. /**
  4.  * This interface provides you with the basic infrastructure necessary
  5.  * to execute multi-threaded code safely in the sub_arctic framework.<P>
  6.  * 
  7.  * This interface defines a function which you can arrange to be called 
  8.  * with the sub_arctic system in a "safe state."  In this state, you
  9.  * can call any methods on any sub_arctic objects in your interface; if
  10.  * you are not in this state, you <STRONG>should not</STRONG> be modifying
  11.  * the interactor tree or any of the sub_arctic infrastructure. <p>
  12.  *
  13.  * To use this interface in a multi-threaded program, the basic steps 
  14.  * are these: 
  15.  * <OL>
  16.  * <LI> Create your own threads and then perform some work (such as
  17.  * read from a network, do a long calculation, etc). When you reach
  18.  * a point where you need to update the user interface, proceed to
  19.  * step 2.
  20.  * <LI> You should now create an instance of any object implementing
  21.  * this (work_proc) interface. The object in question should be
  22.  * set up so that it can update the user interface in the way you
  23.  * desire in its run_safely() method.
  24.  * <LI> Hand this work_proc object and an object you want to be the
  25.  * parameter to run_safely() to the manager using the method
  26.  * perform_work(). This will cause (once the synchronization has
  27.  * been achieved) your code in run_safely() to be executed. The
  28.  * thread making the call on the manager will block until the
  29.  * run_safely() completes. In fact, the thread making the
  30.  * call on perform_work() will be the one executing inside  
  31.  * run_safely().
  32.  * 
  33.  * @author Ian Smith
  34.  */
  35. public interface work_proc {
  36.   /**
  37.    * This is the function that will get called when the world is safely
  38.    * synchronized and you may update the sub_arctic interface.
  39.    *
  40.    * @param Object obj this parameter is the one given to the manager when 
  41.    *                   the "perform_work" method is called.
  42.    */
  43.   public void run_safely(Object obj);
  44.   //xx need to pass in an event here
  45. }
  46. /*=========================== COPYRIGHT NOTICE ===========================
  47.  
  48. This file is part of the subArctic user interface toolkit.
  49.  
  50. Copyright (c) 1996 Scott Hudson and Ian Smith
  51. All rights reserved.
  52.  
  53. The subArctic system is freely available for most uses under the terms
  54. and conditions described in 
  55.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  56. and appearing in full in the lib/interactor.java source file.
  57.  
  58. The current release and additional information about this software can be 
  59. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  60.  
  61. ========================================================================*/
  62.