RunTask

Demonstrates how to run an executable program.

Remarks

This example illustrates how to run the procedure BOUNCE in its own terminal and then attached a function to print a message when the process is terminated.

Note that the running of the callback function cannot interrupt EASI while it is waiting, (for example, at the command-line for user input), while running a task using the RUN command, or while executing the Sleep() intrinsic function. In these cases, the exit function will be executed before the subsequent command is executed.

Code

  global int done

 define function exitfunc( pid, ret_value )
     printf "process %d completed with return value %d!\n", pid, ret_value
     done = 1
 enddefine

 done = 0
 call RunTask( "EASI", "r bounce", "OWNTERM", exitfunc )


 ! Note that the exit-func always takes two arguments, 
 ! the first is the process-id of the task that completed, 
 ! and the second is its return value: 

 ! Since RunTask as set, will run asynchronous, we must add  
 ! a while loop to see the results of the exit function.
 ! We sleep and check periodically to see if we are done. 
 !
 while (done < 1) 
   Call Sleep(1)
   if ( done < 1) then
       print "...waiting..."
   endif
 endwhile

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.