sub_arctic.input
Interface work_proc


public abstract interface work_proc

This interface provides you with the basic infrastructure necessary to execute multi-threaded code safely in the sub_arctic framework.

This interface defines a function which you can arrange to be called with the sub_arctic system in a "safe state." In this state, you can call any methods on any sub_arctic objects in your interface; if you are not in this state, you should not be modifying the interactor tree or any of the sub_arctic infrastructure.

To use this interface in a multi-threaded program, the basic steps are these:

  1. Create your own threads and then perform some work (such as read from a network, do a long calculation, etc). When you reach a point where you need to update the user interface, proceed to step 2.
  2. You should now create an instance of any object implementing this (work_proc) interface. The object in question should be set up so that it can update the user interface in the way you desire in its run_safely() method.
  3. Hand this work_proc object and an object you want to be the parameter to run_safely() to the manager using the method perform_work(). This will cause (once the synchronization has been achieved) your code in run_safely() to be executed. The thread making the call on the manager will block until the run_safely() completes. In fact, the thread making the call on perform_work() will be the one executing inside run_safely().


    Method Summary
     void run_safely(java.lang.Object obj, event e)
              This is the function that will get called when the world is safely synchronized and you may update the sub_arctic interface.
     

    Method Detail

    run_safely

    public void run_safely(java.lang.Object obj,
                           event e)
    This is the function that will get called when the world is safely synchronized and you may update the sub_arctic interface.
    Parameters:
    Object - obj this parameter is the one given to the manager when the "perform_work" method is called.