rbb 99/04/20 08:12:27
Added: docs threadproc.txt
Log:
First pass at thread/process API's for apr.
Revision Changes Path
1.1 apache-apr/docs/threadproc.txt
Index: threadproc.txt
===================================================================
---------------------------Thread/Process abstraction
apr_thread_t *apr_create_thread(void * (void *), void *,
APRUInt32)
Create a new thread
Arguments:
arg 1) pointer to the root function of the new thread. This function
is called when the thread is created. Returning from this
function is the only way to terminate the thread.
arg 2) parameter to pass to thread's root func.
arg 3) size of the stack in bytes. IF zero, APR chooses the machine
specific default size.
return) The thread created.
apr_int32_t apr_fork(apr_proc_t *)
create a new process with a copy of the currently executing address
space.
Arguments:
arg 1) the proccess type for the newly created process.
return) status. APR_FAILURE on error, 0 if child process, 1 if
original
process.
NOTE: This is a non-portable call. It cannot be avoided, and any system
that
can create this function should do so. Any platform that is not able
to produce this function should define it as NULL, so that there are
no compile time errors.
apr_status_t apr_createprocattr_init(apr_procattr_t *);
create a new process attr type with OS dependant defaults
Arguments:
arg 1) New process attribute type.
return) APR_SUCCESS or APR_FAILURE.
apr_status_t apr_setprocattr_io(apr_procattr_t *, apr_int32_t, apr_int32_t,
apr_int32_t)
setup stdin, stdout, and stderr attributes for the new proc
Arguments
arg 1) the process attr to modify
arg 2) Should we setup a pipe for stdin? 1 yes, 0 no.
arg 3) Should we setup a pipe for stdout? 1 yes, 0 no
arg 4) Should we setup a pipe for stderr? 1 yes, 0 no.
return) APR_SUCCESS or APR_FAILURE
NOTE: the file structures are a part of the process atr variable. They are
created and filled out by this func.
apr_status_t apr_setprocattr_dir(apr_procattr_t *, char *)
define starting directory for new process.
Arguments
arg 1) The process attr to modify
arg 2) The starting directory for the new process.
return) APR_SUCCESS or APR_FAILURE
apr_proc_t *apr_create_process(char *, char **, char **, const apr_procattr_t
*)
create a new process and run a new executable in it.
Arguments:
arg 1) Path name of the executable file
arg 2) array of Command line arguments to executable
arg 3) array of environment strings of the form name=value.
If NULL, inherit environ from parent.
arg 4) a pointer to structure that describes the attributes of the new
process. If NULL, process will have the default attributes.
return) Process description structure.
APRStatus apr_procsetcurrdir(APRPROCESSATTR *, char *);
change the current directory of the process attribute structure.
Arguments:
arg 1) Structure to change the dir in.
arg 2) Path to change the directory to in the APRPROCESSATTR struct.
APRStatus apr_get_thread_private(APRUInt32, APThdPriv)
Get the thread private data for the current thread
Arguments:
arg 1) index into thread private data table
arg 2) the thread private data structure. NULL if thread private
has not been set.
APRStatus apr_set_thread_private(APRUInt32, APRThdPriv)
Set per-thread private data.
Arguments:
arg 1) index into thread private data table
arg 2) pointer to per-thread private data structure.
APRStatus apr_newthreadprivateIndex(APRUInt32, APRThdDestFn)
Returns a new index for the thread-private data table and can associate
a destructor with the data that has been assigned to the index.
Arguments:
arg 1) On output this is an index into the thread-private data table
that is valid for all threads in the current process.
arg 2) a destructor function for use with the data associated with
the returned index.
**************** IMPLEMENTATION DETAILS **************
struct apr_thread_t {
pthread_t td;