AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface

◆ RunProgramWaitUntil()

bool drama::thread::RunProgramWaitUntil ( std::chrono::steady_clock::time_point  until,
TMessHandler messHandler,
const std::string &  fileName,
const std::string &  arguments = "",
const std::string &  node = "",
int  priority = 0,
bool  absPriority = false,
bool  setNames = true,
unsigned  stackBytes = 0 
)

Load and run a program using the DRAMA loading mechanisms.

Version with timeout.

This function can be used to load any program using the DRAMA program loading features. It returns when the program exits or after the specified time.

This call must be made from a DRAMA Threaded action implementation, the address of the threaded action object must be passed. The thread will block until the program exits.

You would NOT normally use this to load a DRAMA program, instead use the drama::Path object, GetPath() method. This function is normally only used for non-DRAMA programs.

If the program is to be loaded on a remote note, the DRAMA networking tasks must be running. If to be loaded locally, you either need the DRAMA networking tasks running locally, or the DITS_M_MAY_LOAD flag must have been set when this task was initialised into DRAMA.

This call must be made from a DRAMA Threaded action/uface implementation, the address of the threaded action object must be passed. The thread will block until the operation is successful.

For a relative time, something like the following is needed. (ten second timeout).

   std::chrono::steady_clock::time_point until =
      std::chrono::steady_clock::now() + std::chrono::seconds(10);
      GetPathWaitUntil(until,...);
*
Note
DRAMA does not directly deal with long program names (value of the fileName argument). The limit is about 63 characters. The work around for this is to use environment variables known to IMP_Master on the machine doing the loading (node). The normal approach is to use the ENVVAR:program approach to specifying the node name. E.g. rather then specifying a filename like this:
There would be an environment variable know to the IMP_Master
program defined like this:
      export ENVVAR=/directory1/diretory2/directory3/directory4/
  
And then the ENVVAR:program name will work. Remember that IMP_Master is normally started using dits_netstart.
Parameters
untilUntil when should we wait for this.
messHandlerA pointer to the threaded action/uface thread which is executing this operation.
fileNameThe executable file name for the program to load. Must be understood by the DRAMA networking tasks on the machine on which it is loaded.
argumentsA string of command arguments for the program. For example, under unix, it is put into the argv[] array.
nodeThe node on which to load this program. Both this machine and that machine must be running the DITS networking tasks and they must be able to communicate with each other.
priorityLoad time priority for the task. Most operating systems allow the priority of a task to be set, through many do now allow a higher priority for unless appropriate privileges are available. This argument allows the priority to be set if the task is to be loaded
absPriorityIf true, priority is absolute, otherwise it is relative (an may be negative).
setNamesSet true to insist the names known to the loading task (this task or IMP_Master) be known to the loaded program. Used to control the
inheritance of symbols (logical names and symbols under VMS, environment variables under UNIX) by the new task. If specified, this flag insists that symbols known to the IMP_Master task (or this task if DITS_M_MAY_LOAD is set and iff no master task is running) be inherited by the new task. If not set, it is at the discretion of the master task whether this is done.
stackBytesSet the stack size for the load. Some operating systems (VxWorks) allow you to set the stack size when the program is loaded. This argument allows you to set the value. It is ignored for other operation systems. If 0, then use the default.
Returns
Returns true if the program completed (without error), false for a timeout. If program completes with error, an exception is thrown.