#include "thread.h"Data Structures | |
| struct | ThreadArg |
| struct | Thread |
Defines | |
| #define | FLAG_DETACHED 1 |
| #define | FLAG_HAVESTACK 2 |
| #define | FLAG_STACKDOWN 4 |
Functions | |
| void | NsThreads_LibInit (void) |
| void | Ns_ThreadCreate (Ns_ThreadProc *proc, void *arg, long stacksize, Ns_Thread *resultPtr) |
| long | Ns_ThreadStackSize (long stacksize) |
| void | NsThreadMain (void *arg) |
| char * | Ns_ThreadGetName (void) |
| void | Ns_ThreadSetName (char *name) |
| char * | Ns_ThreadGetParent (void) |
| void | Ns_ThreadList (Tcl_DString *dsPtr, Ns_ThreadArgProc *proc) |
| int | Ns_CheckStack (void) |
| #define FLAG_DETACHED 1 |
Private flags for managing threads.
| #define FLAG_HAVESTACK 2 |
| #define FLAG_STACKDOWN 4 |
| int Ns_CheckStack | ( | void | ) |
----------------------------------------------------------------------
Ns_CheckStack --
Check a thread stack for overflow.
Results: NS_OK: Stack appears ok. NS_BREAK: Overflow appears likely. NS_ERROR: Stack address/size unknown.
Side effects: None.
----------------------------------------------------------------------
Return error on no stack.
Check if the stack has grown into or beyond the guard.
| void Ns_ThreadCreate | ( | Ns_ThreadProc * | proc, | |
| void * | arg, | |||
| long | stacksize, | |||
| Ns_Thread * | resultPtr | |||
| ) |
----------------------------------------------------------------------
Ns_ThreadCreate --
Create a new thread thread.
Results: None.
Side effects: A new thread is allocated and started.
----------------------------------------------------------------------
Determine the stack size and add the guard.
Create the thread.
| char* Ns_ThreadGetName | ( | void | ) |
----------------------------------------------------------------------
Ns_ThreadGetName --
Return a pointer to calling thread's string name.
Results: Pointer to thread name string.
Side effects: None.
----------------------------------------------------------------------
| char* Ns_ThreadGetParent | ( | void | ) |
----------------------------------------------------------------------
Ns_ThreadGetParent --
Return a pointer to calling thread's parent name.
Results: Pointer to thread parent name string.
Side effects: None.
----------------------------------------------------------------------
| void Ns_ThreadList | ( | Tcl_DString * | dsPtr, | |
| Ns_ThreadArgProc * | proc | |||
| ) |
----------------------------------------------------------------------
Ns_ThreadList --
Append info for each thread.
Results: None.
Side effects: None.
----------------------------------------------------------------------
| void Ns_ThreadSetName | ( | char * | name | ) |
----------------------------------------------------------------------
Ns_ThreadSetName --
Set the name of the calling thread.
Results: None.
Side effects: String is copied to thread data structure.
----------------------------------------------------------------------
| long Ns_ThreadStackSize | ( | long | stacksize | ) |
----------------------------------------------------------------------
Ns_ThreadStackSize --
Set default stack size.
Results: Previous stack size.
Side effects: New threads will use default size.
----------------------------------------------------------------------
| void NsThreadMain | ( | void * | arg | ) |
----------------------------------------------------------------------
ThreadMain --
Thread startup routine. Sets the given pre-allocated thread structure and calls the user specified procedure.
Results: None. Will call Ns_ThreadExit if not called by the user code.
Side effects: None.
----------------------------------------------------------------------
| void NsThreads_LibInit | ( | void | ) |
----------------------------------------------------------------------
NsThreads_LibInit --
Initialize threads interface.
Results: None.
Side effects: Allocates pthread_key_t for thread context.
----------------------------------------------------------------------
1.5.1