word ThreadGetInfo(
ThreadHandle th, /* thread to get information about */
ThreadGetInfoType info); /* type of information to get */
This routine gets information about the specified thread. The information desired is specified in the
info
parameter; the subject thread is specified in the
th
parameter. If the thread handle passed is zero or a null handle, the routine will return information about the calling thread.
The
info
parameter is one of the following values of
ThreadGetInfoType
, specifying the type of information to be returned by
ThreadGetInfo()
:
th
parameter is zero, this will return the thread handle of the subject thread. If
th
is zero, the handle of the calling thread will be returned.
th
. If the thread specified is not event-driven, a null queue handle will be returned.Include: thread.h
void ThreadGrabThreadLock(
ThreadLockHandle sem); /* thread lock to grab */
This routine attempts to grab the thread lock for the calling thread. If the thread lock is currently held by another thread, the caller will block until the lock becomes available. If the caller already has the thread lock, it will grab the lock again and continue executing.
Be Sure To: Thread locks must be released with
ThreadReleaseThreadLock()
once for each time they are grabbed.
Warnings: This routine provides no deadlock protection for multiple threads. If multiple threads will be grabbing multiple thread locks, the locks should always be grabbed in the same order to minimize the potential for deadlock.
Include: sem.h
See Also: ThreadAllocThreadLock(),
ThreadReleaseThreadLock().
void ThreadHandleException(
ThreadHandle th, /* thread to handle the exception */
ThreadExceptions exception, /* exception to handle */
void (*handler) ()); /* pointer to handler */
This routine allows a thread to set up a handler for a processor exception. This can be useful for debugging purposes. Pass the following three parameters:
th
exception
ThreadException
type (see below).
handler
Structures: The
ThreadException
type has the following values:
TE_DIVIDE_BY_ZERO TE_OVERFLOW TE_BOUND TE_FPU_EXCEPTION TE_SINGLE_STEP TE_BREAKPOINT
Include: thread.h
void ThreadModify(
ThreadHandle th, /* thread to modify */
word newBasePriority, /* thread's new base priority */
ThreadModifyFlags flags); /* flags (see below) */
This routine modifies the priority of the specified thread. Use it to either set the base priority of the thread or reset the current CPU usage to zero. The parameters should have the following values:
th
newBasePriority
ThreadCreate()
--or use a value between zero and 255.
flags
ThreadModifyFlags
; pass TMF_BASE_PRIO to change the thread's base priority or TMF_ZERO_USAGE to reset the thread's recent CPU usage to zero.Warnings: Unless the thread is timing-critical, you should not set the base priority to zero.
Include: thread.h
word ThreadPrivAlloc(
word wordsRequested, /* number of words to allocate */
GeodeHandle owner); /* handle of geode to own data */
This routine allocates a number of contiguous words in the private data of all geodes (loaded and yet-to-be loaded). It is exactly the same as
GeodePrivAlloc()
; see the entry for that routine.
Include: thread.h
See Also: GeodePrivAlloc().
void ThreadPrivFree(
word range, /* offset to first word to be freed */
word wordsRequested); /* number of words to free */
This routine frees a number of contiguous private-data words previously allocated with
ThreadPrivAlloc()
. It is similar to
GeodePrivFree()
; see the entry for that routine for full information.
Include: thread.h
See Also: GeodePrivFree().
GEOS SDK TechDocs
|
|
ThreadAttachToQueue() ...
|
ThreadPSem() ...