version 1.24, 2002/09/17 18:01:03
|
version 1.30, 2003/08/04 20:19:25
|
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#ifndef Pegasus_Thread_h | #ifndef Pegasus_Thread_h |
#define Pegasus_Thread_h | #define Pegasus_Thread_h |
|
|
|
#include <cstring> |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/IPC.h> | #include <Pegasus/Common/IPC.h> |
#include <Pegasus/Common/InternalException.h> | #include <Pegasus/Common/InternalException.h> |
#include <Pegasus/Common/DQueue.h> | #include <Pegasus/Common/DQueue.h> |
|
#include <Pegasus/Common/AcceptLanguages.h> // l10n |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
void cancel(void); | void cancel(void); |
| |
// cancel if there is a pending cancellation request | // cancel if there is a pending cancellation request |
static void test_cancel(void); |
void test_cancel(void); |
| |
Boolean is_cancelled(void); | Boolean is_cancelled(void); |
| |
|
|
| |
void thread_switch(void); | void thread_switch(void); |
| |
#if defined(PEGASUS_PLATFORM_LINUX_IX86_GNU) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
#if defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
// suspend this thread | // suspend this thread |
void suspend(void) ; | void suspend(void) ; |
| |
|
|
| |
// thread routine needs to call this function when | // thread routine needs to call this function when |
// it is ready to exit | // it is ready to exit |
static void exit_self(PEGASUS_THREAD_RETURN return_code) ; |
void exit_self(PEGASUS_THREAD_RETURN return_code) ; |
| |
// stack of functions to be called when thread terminates | // stack of functions to be called when thread terminates |
// will be called last in first out (LIFO) | // will be called last in first out (LIFO) |
|
|
| |
void detach(void); | void detach(void); |
| |
|
// |
|
// Gets the Thread object associated with the caller's thread. |
|
// Note: this may return NULL |
|
// |
|
static Thread * getCurrent(); // l10n |
|
|
|
// |
|
// Sets the Thread object associated with the caller's thread |
|
// |
|
static void setCurrent(Thread * thrd); // l10n |
|
|
|
// |
|
// Gets the AcceptLanguages associated with the caller's |
|
// Thread. |
|
// Note: this may return NULL |
|
// |
|
static AcceptLanguages * getLanguages(); //l10n |
|
|
|
// |
|
// Sets the AcceptLanguages associated with the caller's |
|
// Thread. |
|
// |
|
static void setLanguages(AcceptLanguages *langs); //l10n |
|
|
|
// |
|
// Removes the AcceptLanguages associated with the caller's |
|
// Thread. |
|
// |
|
static void clearLanguages(); //l10n |
|
|
private: | private: |
Thread(); | Thread(); |
|
|
|
static Sint8 initializeKey(); // l10n |
|
|
inline void create_tsd(const Sint8 *key ) throw(IPCException) | inline void create_tsd(const Sint8 *key ) throw(IPCException) |
{ | { |
thread_data *tsd = new thread_data(key); | thread_data *tsd = new thread_data(key); |
|
|
void *_thread_parm; | void *_thread_parm; |
PEGASUS_THREAD_RETURN _exit_code; | PEGASUS_THREAD_RETURN _exit_code; |
static Boolean _signals_blocked; | static Boolean _signals_blocked; |
|
static PEGASUS_THREAD_KEY_TYPE _platform_thread_key; //l10n |
|
static Boolean _key_initialized; // l10n |
|
static Boolean _key_error; // l10n |
friend class ThreadPool; | friend class ThreadPool; |
} ; | } ; |
| |