\input manualMacros.tex
\manBegin
\manPageInfo{RCI Reference Manual}{}{}
\manTitle{rciExecute}{3}
\manSection{NAME}
{\tt \manName{rciExecute}}
 -- execute function for an RCI task.
\manSection{USAGE}
\cverbatim
rciExecute (td, fxn, arg, ret)
   RCI_DESC *td;
   int (*fxn)();
   int arg;
   int *ret; @endcverbatim
\manSection{ARGUMENTS}
\manItem{{\tt td} --}
Pointer to RCI task descriptor.
\manItem{{\tt fxn} --}
Pointer to function to be executed.
\manItem{{\tt arg} --}
Argument to the function.
\manItem{{\tt ret} --}
If not {\tt NULL}, this is used to accept the return value from the function.
\manSection{RESTRICTIONS}
This routine must be called from the planning level.
\manSection{DESCRIPTION}
{\tt rciExecute()}
executes a function for a particular control
task. This may be done at any time, whether the task is {\it active} or
{\it idle}. It is guaranteed, however, that the execution of this function
will {\bf not} interrupt the execution of a control function belonging 
to the same task, and vice versa.

The function {\tt fxn} is called by the task's monitor, on the CPU
assigned to that task, with {\tt td} and {\tt arg} as arguments:
\cverbatim
        (*fxn)(td, arg);@endcverbatim
\manSection{DIAGNOSTICS}
The function returns {\tt -1} when an error occurs.
Error information is reported on the {\it errorStack} (q.v.).

Returned error codes, accessible with {\tt getErrorCode()}, are:

\manItem{{\tt EDescriptor} --}
Invalid task descriptor.
\manItem{{\tt ERange} --}
The address associated with the function lies outside of the 
{\it control text} area.
\manItem{{\tt EInternal} --}
Unexpected internal software problem, or loss of communication with the
monitor.

The routine will abort the program if called from the control level.
\manSection{SEE ALSO}
\raggedright
{\tt rciCreate(3)}, {\tt rciStart(3)}, {\tt rciControlFxns(3)},
{\tt errorStack(3)}.
\manEnd
\end
