Using Threads in C for RAD
The following are thread functions in the C language for RAD:
-
void *rad_thread_arg(rad_thread_t *tp);
-
Returns the
arg
referenced by the threadtp
. -
void rad_thread_ack(rad_thread_t *tp, rad_moderr_t error);
-
Acknowledges the thread referenced by
tp
. This process enables the controlling thread, from which a new thread was created using rad_thread_create, to make progress. The error is used to update the return value from rad_thread_create and is set toRM_OK
for success.This function is intended to be used from a user function previously supplied as an argument to rad_thread_create. It should not be used in any other context.
-
rad_moderr_t rad_thread_create(rad_threadfp_t fp, void *arg);
-
Creates a thread to run fp. This function will not return until the user function (fp) calls rad_thread_ack.
arg
is stored and passed into fp as a member of therad_thread_t
data. It can be accessed using rad_thread_arg. -
rad_moderr_t rad_thread_create_async(rad_thread_asyncfp_t fp, void *arg);
-
Creates a thread to run fp.
arg
is stored and passed into fp.