AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
thread.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_OSL_THREAD_H
5 #define INCLUDED_OSL_THREAD_H
6 
7 #include "sal/config.h"
8 
9 #include "osl/time.h"
10 #include "rtl/textenc.h"
11 #include "sal/saldllapi.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
21 typedef void* oslThread;
22 
25 typedef void (SAL_CALL *oslWorkerFunction)(void*);
26 
32 typedef enum
33 {
39  osl_Thread_PriorityUnknown, /* don't use to set */
42 
43 
44 typedef sal_uInt32 oslThreadIdentifier;
45 
46 typedef void* oslThreadKey;
47 
59 SAL_DLLPUBLIC oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker, void* pThreadData);
60 
72 SAL_DLLPUBLIC oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker, void* pThreadData);
73 
81 SAL_DLLPUBLIC oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread);
82 
90 SAL_DLLPUBLIC void SAL_CALL osl_destroyThread(oslThread Thread);
91 
97 SAL_DLLPUBLIC void SAL_CALL osl_resumeThread(oslThread Thread);
98 
104 SAL_DLLPUBLIC void SAL_CALL osl_suspendThread(oslThread Thread);
105 
112 SAL_DLLPUBLIC void SAL_CALL osl_setThreadPriority(oslThread Thread, oslThreadPriority Priority);
113 
120 SAL_DLLPUBLIC oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread);
121 
128 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread);
129 
135 SAL_DLLPUBLIC void SAL_CALL osl_joinWithThread(oslThread Thread);
136 
142 SAL_DLLPUBLIC void SAL_CALL osl_waitThread(const TimeValue* pDelay);
143 
149 SAL_DLLPUBLIC void SAL_CALL osl_terminateThread(oslThread Thread);
150 
159 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread);
160 
168 SAL_DLLPUBLIC void SAL_CALL osl_yieldThread(void);
169 
180 SAL_DLLPUBLIC void SAL_CALL osl_setThreadName(char const * name);
181 
182 /* Callback when data stored in a thread key is no longer needed */
183 
184 typedef void (SAL_CALL *oslThreadKeyCallbackFunction)(void *);
185 
187 SAL_DLLPUBLIC oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback);
188 
190 SAL_DLLPUBLIC void SAL_CALL osl_destroyThreadKey(oslThreadKey Key);
191 
193 SAL_DLLPUBLIC void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key);
194 
196 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData);
197 
200 
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 #endif // INCLUDED_OSL_THREAD_H
211 
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC sal_Bool osl_scheduleThread(oslThread Thread)
Schedules in thread to wait till after time slice of specified thread.
oslThreadPriority
levels of thread-priority Note that oslThreadPriorityUnknown might be returned by getPriorityOfThread...
Definition: thread.h:32
void(* oslThreadKeyCallbackFunction)(void *)
Definition: thread.h:184
SAL_DLLPUBLIC oslThread osl_createSuspendedThread(oslWorkerFunction pWorker, void *pThreadData)
Create the thread, using the function-ptr pWorker as its main (worker) function.
Time since Jan-01-1970.
Definition: time.h:56
Definition: thread.h:36
unsigned char sal_Bool
Definition: types.h:18
SAL_DLLPUBLIC void osl_resumeThread(oslThread Thread)
Wake-up a thread that was suspended with suspend() or createSuspended().
sal_uInt32 oslThreadIdentifier
Definition: thread.h:44
void(* oslWorkerFunction)(void *)
the function-ptr.
Definition: thread.h:25
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:17
Definition: thread.h:38
SAL_DLLPUBLIC oslThread osl_createThread(oslWorkerFunction pWorker, void *pThreadData)
Create the thread, using the function-ptr pWorker as its main (worker) function.
Definition: thread.h:37
SAL_DLLPUBLIC void osl_joinWithThread(oslThread Thread)
Blocks the calling thread until Thread has terminated.
SAL_DLLPUBLIC void osl_destroyThreadKey(oslThreadKey Key)
Destroy a key to an associated thread local storage pointer.
SAL_DLLPUBLIC oslThreadPriority osl_getThreadPriority(const oslThread Thread)
Retrieves the threads priority.
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...
SAL_DLLPUBLIC rtl_TextEncoding osl_setThreadTextEncoding(rtl_TextEncoding Encoding)
Set the thread local text encoding.
SAL_DLLPUBLIC oslThreadKey osl_createThreadKey(oslThreadKeyCallbackFunction pCallback)
Create a key to an associated thread local storage pointer.
SAL_DLLPUBLIC void * osl_getThreadKeyData(oslThreadKey Key)
Get to key associated thread specific data.
SAL_DLLPUBLIC sal_Bool osl_isThreadRunning(const oslThread Thread)
Returns True if the thread was created and has not terminated yet.
SAL_DLLPUBLIC void osl_yieldThread(void)
Offers the rest of the threads time-slice to the OS.
SAL_DLLPUBLIC sal_Bool osl_setThreadKeyData(oslThreadKey Key, void *pData)
Set to key associated thread specific data.
void * oslThreadKey
Definition: thread.h:46
#define SAL_MAX_ENUM
Definition: types.h:185
SAL_DLLPUBLIC void osl_terminateThread(oslThread Thread)
The requested thread will get terminate the next time scheduleThread() is called. ...
SAL_DLLPUBLIC rtl_TextEncoding osl_getThreadTextEncoding(void)
Get the current thread local text encoding.
SAL_DLLPUBLIC void osl_setThreadName(char const *name)
Attempts to set the name of the current thread.
Definition: thread.h:39
SAL_DLLPUBLIC void osl_suspendThread(oslThread Thread)
Suspend the execution of the thread.
SAL_DLLPUBLIC void osl_setThreadPriority(oslThread Thread, oslThreadPriority Priority)
Changes the threads priority.
Definition: thread.h:35
SAL_DLLPUBLIC void osl_waitThread(const TimeValue *pDelay)
Suspends the execution of the calling thread for at least the given time.
Definition: thread.h:34
void * oslThread
Opaque data type for threads.
Definition: thread.h:21
SAL_DLLPUBLIC void osl_destroyThread(oslThread Thread)
Release the thread handle.
#define SAL_DLLPUBLIC
Definition: saldllapi.h:14