PPL Logo

util/RTH.h File Reference

Go to the source code of this file.

Data Structures

class  RTH_Locals
 All the local variables for RTH routines are stored in subclasses of this type. More...

Typedefs

typedef void(* RTH_Routine )(RTH_Runtime *runtime, void *object, RTH_Locals *locals, int pc)
 An RTH user subroutine, declared using the RTH_Routine_* macros.

Functions

RTH_RuntimeRTH_Runtime_create (RTH_Routine fn, int localsSize, void *obj)
 Create a new RTH runtime that will run this function on its first "resume" call.
RTH_RuntimeRTH_Runtime_pup (RTH_Runtime *runtime, PUP::er &p, void *obj)
 Pup this RTH_Runtime.
void RTH_Runtime_suspend (RTH_Runtime *runtime, int nextPC)
 "Block" this RTH thread.
void RTH_Runtime_resume (RTH_Runtime *runtime)
 Resume the blocked RTH thread immediately.
int RTH_Runtime_call (RTH_Runtime *runtime, RTH_Routine fn, int localsSize, int nextPC)
 Call this RTH subroutine inline.
void RTH_Runtime_done (RTH_Runtime *runtime)
 Called at the end of an RTH routine.
void RTH_Runtime_destroy (RTH_Runtime *runtime)
 Dispose of the RTH runtime.


Typedef Documentation

typedef void(* RTH_Routine)(RTH_Runtime *runtime, void *object, RTH_Locals *locals, int pc)

An RTH user subroutine, declared using the RTH_Routine_* macros.

Definition at line 37 of file RTH.h.


Function Documentation

RTH_Runtime* RTH_Runtime_create ( RTH_Routine  fn,
int  localsSize,
void *  obj 
)

Create a new RTH runtime that will run this function on its first "resume" call.

Definition at line 122 of file RTH.C.

References PC_START, and RTH_StackFrame::RTH_StackFrame().

RTH_Runtime* RTH_Runtime_pup ( RTH_Runtime runtime,
PUP::er p,
void *  obj 
)

Pup this RTH_Runtime.

This routine can be called on an uninitialized RTH_Runtime if the PUP::er is unpacking. This does *not* free the RTH_Runtime, so call RTH_Runtime_free in your destructor as usual.

Definition at line 126 of file RTH.C.

References PUP::er::isUnpacking(), RTH_Runtime::pup(), and RTH_StackFrame::RTH_StackFrame().

void RTH_Runtime_suspend ( RTH_Runtime runtime,
int  nextPC 
)

"Block" this RTH thread.

Saves the currently running function and nextPC for later "resume" call. Unlike a real thread, this routine returns, and you're expected to exit the RTH_fn immediately. Also see the RTH_Suspend macro, which can be used directly from inside a user RTH_Routine.

Saves the currently running function and returnPC for later "resume" call. Unlike a real thread, this routine returns, and you're expected to then exit the calling RTH routine immediately.

Definition at line 139 of file RTH.C.

References RTH_StackFrame::pc, and RTH_Runtime::tos().

void RTH_Runtime_resume ( RTH_Runtime runtime  ) 

Resume the blocked RTH thread immediately.

This call will not return until the thread blocks again.

This call will not return until the thread blocks or finishes.

Definition at line 146 of file RTH.C.

References RTH_StackFrame::invoke(), RTH_Runtime::terminated, and RTH_Runtime::tos().

int RTH_Runtime_call ( RTH_Runtime runtime,
RTH_Routine  fn,
int  localsSize,
int  nextPC 
)

Call this RTH subroutine inline.

Returns 0 if the current thread should block. (i.e., the call "failed")

Definition at line 172 of file RTH.C.

References RTH_StackFrame::invoke(), RTH_StackFrame::pc, PC_START, RTH_Runtime::push(), RTH_StackFrame::RTH_StackFrame(), and RTH_Runtime::tos().

void RTH_Runtime_done ( RTH_Runtime runtime  ) 

Called at the end of an RTH routine.

Allows the next routine to be started.

Definition at line 154 of file RTH.C.

References RTH_StackFrame::invoke(), RTH_StackFrame::pc, PC_START, RTH_Runtime::pop(), and RTH_Runtime::tos().

void RTH_Runtime_destroy ( RTH_Runtime runtime  ) 

Dispose of the RTH runtime.

Does not free the user object.

Definition at line 166 of file RTH.C.


Generated on Tue May 22 07:44:31 2012 for Charm++ by  doxygen 1.5.5