24 #ifndef INCLUDED_OSL_THREAD_HXX
25 #define INCLUDED_OSL_THREAD_HXX
43 extern "C" inline void SAL_CALL
threadFunc(
void* param);
58 static void * SAL_CALL
operator new(
size_t nSize )
60 static void SAL_CALL
operator delete(
void * pMem )
62 static void * SAL_CALL
operator new( size_t,
void * pMem )
64 static void SAL_CALL
operator delete(
void *,
void * )
76 assert(m_hThread == NULL);
78 if (m_hThread == NULL)
88 assert(m_hThread == NULL);
92 static_cast<void*>(
this));
93 return m_hThread != NULL;
174 friend void SAL_CALL
threadFunc(
void* param);
176 virtual void SAL_CALL
run() = 0;
friend void threadFunc(void *param)
The thread functions calls the protected functions run and onTerminated.
static void setName(char const *name) SAL_NOEXCEPT
Definition: thread.hxx:155
SAL_DLLPUBLIC sal_Bool osl_scheduleThread(oslThread Thread)
Schedules in thread to wait till after time slice of specified thread.
SAL_DLLPUBLIC oslThread osl_createSuspendedThread(oslWorkerFunction pWorker, void *pThreadData)
Create the thread, using the function-ptr pWorker as its main (worker) function.
SAL_DLLPUBLIC void osl_setThreadPriority(oslThread Thread, oslThreadPriority Priority)
Changes the threads priority.
void * oslThreadKey
Definition: thread.h:66
oslThreadPriority getPriority() const
Definition: thread.hxx:130
oslThreadPriority
levels of thread-priority Note that oslThreadPriorityUnknown might be returned by getPriorityOfThread...
Definition: thread.h:52
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
virtual void join()
Definition: thread.hxx:114
virtual void resume()
Definition: thread.hxx:102
bool isRunning() const
Definition: thread.hxx:119
virtual void onTerminated()
Definition: thread.hxx:178
ThreadData(oslThreadKeyCallbackFunction pCallback=NULL)
Create a thread specific local data key.
Definition: thread.hxx:199
bool setData(void *pData)
Set the data associated with the data key.
Definition: thread.hxx:213
SAL_DLLPUBLIC void osl_joinWithThread(oslThread Thread)
Blocks the calling thread until Thread has terminated.
~ThreadData()
Destroy a thread specific local data key.
Definition: thread.hxx:205
SAL_DLLPUBLIC void osl_destroyThreadKey(oslThreadKey Key)
Destroy a key to an associated thread local storage pointer.
Definition: thread.hxx:193
virtual void suspend()
Definition: thread.hxx:96
SAL_DLLPUBLIC oslThreadKey osl_createThreadKey(oslThreadKeyCallbackFunction pCallback)
Create a key to an associated thread local storage pointer.
void threadFunc(void *param)
threadFunc is the function which is executed by the threads created by the osl::Thread class...
Definition: thread.hxx:186
Thread()
Definition: thread.hxx:67
static oslThreadIdentifier getCurrentIdentifier()
Definition: thread.hxx:140
SAL_DLLPUBLIC sal_Bool osl_isThreadRunning(const oslThread Thread)
Returns True if the thread was created and has not terminated yet.
SAL_DLLPUBLIC oslThreadIdentifier osl_getThreadIdentifier(oslThread Thread)
Get the identifier for the specified thread or if parameter Thread is NULL of the current active thre...
virtual void terminate()
Definition: thread.hxx:108
virtual ~Thread() COVERITY_NOEXCEPT_FALSE
Definition: thread.hxx:69
void * getData()
Get the data associated with the data key.
Definition: thread.hxx:222
static void wait(const TimeValue &Delay)
Definition: thread.hxx:145
static void yield()
Definition: thread.hxx:150
SAL_DLLPUBLIC void osl_setThreadName(char const *name)
Attempts to set the name of the current thread.
virtual bool schedule()
Definition: thread.hxx:159
SAL_DLLPUBLIC void osl_waitThread(const TimeValue *pDelay)
Suspends the execution of the calling thread for at least the given time.
bool createSuspended()
Definition: thread.hxx:86
SAL_DLLPUBLIC void osl_destroyThread(oslThread Thread)
Release the thread handle.
SAL_DLLPUBLIC sal_Bool osl_setThreadKeyData(oslThreadKey Key, void *pData)
Set to key associated thread specific data.
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:378
void setPriority(oslThreadPriority Priority)
Definition: thread.hxx:124
#define COVERITY_NOEXCEPT_FALSE
To markup destructors that coverity warns might throw exceptions which won't throw in practice...
Definition: types.h:349
SAL_DLLPUBLIC oslThreadPriority osl_getThreadPriority(const oslThread Thread)
Retrieves the threads priority.
SAL_DLLPUBLIC void osl_yieldThread(void)
Offers the rest of the threads time-slice to the OS.
void * oslThread
Opaque data type for threads.
Definition: thread.h:41
A thread abstraction.
Definition: thread.hxx:52
SAL_DLLPUBLIC void osl_suspendThread(oslThread Thread)
Suspend the execution of the thread.
oslThreadIdentifier getIdentifier() const
Definition: thread.hxx:135
SAL_DLLPUBLIC void osl_resumeThread(oslThread Thread)
Wake-up a thread that was suspended with suspend() or createSuspended().
SAL_DLLPUBLIC void osl_terminateThread(oslThread Thread)
The requested thread will get terminate the next time scheduleThread() is called. ...
sal_uInt32 oslThreadIdentifier
Definition: thread.h:64
bool create()
Definition: thread.hxx:74
#define SAL_NOEXCEPT
Macro for C++11 "noexcept" vs.
Definition: types.h:416
void(* oslThreadKeyCallbackFunction)(void *)
Definition: thread.h:204
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
SAL_DLLPUBLIC void * osl_getThreadKeyData(oslThreadKey Key)
Get to key associated thread specific data.