LWP_STATUS(3L)

NAME
lwp_self, lwp_ping, lwp_enumerate, lwp_getstate, lwp_setregs, lwp_getregs - LWP status information

SYNOPSIS
#include <lwp/lwp.h>
#include <lwp/lwpmachdep.h>

int
lwp_enumerate(vec, maxsize)
thread_t vec[];	/* list of id's to be filled in */
int maxsize;	/* number of elements in vec */

int
lwp_ping(tid)
thread_t tid;

int
lwp_getregs(tid, machstate)
thread_t tid;
machstate_t *machstate;

int
lwp_setregs(tid, machstate)
thread_t tid;
machstate_t *machstate;

int
lwp_getstate(tid, statvec)
thread_t tid;
statvec_t *statvec;

int
lwp_self(tid)
thread_t *tid;

DESCRIPTION

lwp_self() returns the ID of the current thread in tid. This is the only way to retrieve the identity of main.

lwp_enumerate() fills in a list with the ID's of all existing threads and returns the total number of threads. This primitive will use maxsize to avoid exceeding the capacity of the list. If the number of threads is greater than maxsize, only maxsize thread ID's are filled in vec. If maxsize is zero, lwp_enumerate() just returns the total number of threads.

lwp_getstate() is used to retrieve the context of a given thread. It is possible to see what object (thread, monitor, etc.) if any that thread is blocked on, and the scheduling priority of the thread.

lwp_ping returns 0 (no error) if the thread tid exists. Otherwise, -1 is returned.

lwp_setregs sets the machine-dependent context (i.e., registers) of a thread. The next time the thread is scheduled in, this context is installed. Consult lwpmachdep.h for the details. lwp_getregs retrieves the machine-dependent context. Note: the registers may not be meaningful unless the thread in question is blocked or suspended because the state of the registers as of the most recent context switch is returned.

RETURNS
Upon successful completion, lwp_self and lwp_getstate() return 0, -1 on error.

lwp_enumerate() returns the total number of threads.

lwp_ping returns 0 if the specified thread exists, else -1.

ERRORS
lwp_getstatea() , lwp_ping() , and lwp_setstate() will fail if one or more of the following is true:

LE_NONEXIST
    Attempt to get the status of a non-existent thread.