_lwp_makecontext(S)
_lwp_makecontext --
make an LWP context
Synopsis
#include <types.h>
#include <sys/lwp.h>
#include <ucontext.h>
void _lwp_makecontext(ucontext_t *ucp, void (*start_routine)(void *arg),
void *arg, void *private, caddr_t stackbase, size_t stacksize);
Parameters
ucp-
pointer to the context (to be filled)
start_routine-
pointer to function to be called on creation of the LWP
arg-
pointer to argument to start_routine
private-
pointer to initial value for private data pointer
stackbase-
pointer to stack area
stacksize-
size of stack area
Description
_lwp_makecontext fills in a context for a lightweight process (LWP).
The storage for the context is allocated by the user.
This interface is provided to fill in a ucontext to pass
to _lwp_create,
allowing library implementors full flexibility in setting up
the abstractions they implement,
while ensuring that they start with a coherent minimal set of
information to execute an LWP.
If the LWP, when created, returns from its start_routine
this is treated as an implicit _lwp_exit.
The ucontext_t object is returned with the appropriate system
information based on the parameters from _lwp_makecontext.
ucp parameter
_lwp_makecontext fills in the uninitialized context pointed to
by ucp.
start_routine parameter
start_routine is the function to be called on creation of the LWP;
it establishes the program counter for the context.
arg parameter
arg is the argument to start_routine.
private parameter
private is the initial value for the private data pointer (this is
likely to be the address of the user level LWP descriptor in many implementations).
stackbase parameter
stackbase is the pointer to a user-allocated stack area.
stacksize parameter
stacksize is the size of the user-allocated stack area.
Return values
The values set in ucp are intended to be passed to _lwp_create.
Errors
If any of the following conditions is detected,
thr_create returns the appropriate value:
EFAULT-
One or more of ucp, start_routine, arg, or private
point to an illegal address.
(This error may not be detected; a SIGSEGV signal may be posted to the
faulting LWP if an illegal address is used.)
Usage
Unlike threads, the start function called for _lwp_create returns void.
This means that there is no return value available through _lwp_wait,
and that less information from an LWP context needs to be retained past
_lwp_exit.
References
_lwp_exit(S),
_lwp_create(S),
getcontext(S),
makecontext(S),
ucontext(M)
Notices
Lightweight processes (LWPs) are internal interfaces and are subject
to change.
Their use should be avoided.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005