Previous Next        Current Page: NeXtMidas Training / Primitives / Primitive Restarts / Control Flow (Restart)
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   + Special Variables   
   + Lab 2   
   + Lab 3*   
   + Files in a Primitive   
   + Lab 4   
   + Lab 5*   
   + Test Macros   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   - Primitive Restarts   
      - Using Restarts   
      - Control Flow (Restart)   
      - Control Flow (Restart)   
      - Restart-Safe Primitives   
      - Preserving State   
      - Restarting a Primitive   
   + Introduction to DSP   
   + Lab 9   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Control flow during a restart:
    • A restart is triggered by setting the state of a primitive to RESTART. Never directly call restart().
    • After the current call to process() is done Command will automatically check the primitive state. If the state is set to RESTART it will call restart().
      • While this may seem trivial, it is very important because it ensures that the current call to process() is not interrupted.
    • The restart() method restarts a primitive by calling close() and then open() before allowing the primitive to return to process().
      • To most primitives a restart is nothing more than "typical" operation because it sees open(), process(), ..., process(), close() just like it normally does. The only difference is that the close() is immediately followed by whole "new" execution of the primitive.
    Click image for larger view.