Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

API

SDK

Tips ‘n’ Tricks

Miscellaneous


Global Functions in Global Namespace C++
in Sourcefile thread.h


osl_createSuspendedThread
extern "C"
oslThread osl_createSuspendedThread(
oslWorkerFunction pWorker,
void * pThreadData );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Create the thread, using the function-ptr pWorker as its main (worker) function. This functions receives in its void* parameter the value supplied by pThreadData. The thread will be created, but it won't start running. To wake-up the thread, use resume().
Return
0 if creation failed, otherwise a handle to the thread

osl_createThread
extern "C"
oslThread osl_createThread(
oslWorkerFunction pWorker,
void * pThreadData );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Create the thread, using the function-ptr pWorker as its main (worker) function. This functions receives in its void* parameter the value supplied by pThreadData. Once the OS-structures are initialized,the thread starts running.
Return
0 if creation failed, otherwise a handle to the thread

osl_createThreadKey
extern "C"
oslThreadKey osl_createThreadKey(
oslThreadKeyCallbackFunction pCallback );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Create a key to an associated thread local storage pointer.

osl_destroyThread
extern "C"
void osl_destroyThread(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Release the thread handle. If Thread is NULL, the function won't do anything. Note that we do not interfere with the actual running of the thread, we just free up the memory needed by the handle.

osl_destroyThreadKey
extern "C"
void osl_destroyThreadKey(
oslThreadKey Key );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Destroy a key to an associated thread local storage pointer.

osl_getThreadIdentifier
extern "C"
oslThreadIdentifier osl_getThreadIdentifier(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Get the identifier for the specified thread or if parameter Thread is NULL of the current active thread.
Return
identifier of the thread

osl_getThreadKeyData
extern "C"
void * osl_getThreadKeyData(
oslThreadKey Key );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Get to key associated thread specific data.

osl_getThreadPriority
extern "C"
oslThreadPriority osl_getThreadPriority(
const oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Retrieves the threads priority. Returns oslThreadPriorityUnknown for invalid Thread-argument or terminated thread. (I.e.: The oslThread might be invalid.)

osl_getThreadTextEncoding
extern "C"
rtl_TextEncoding osl_getThreadTextEncoding(
void );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Get the current thread local text encoding.

osl_isThreadRunning
extern "C"
sal_Bool osl_isThreadRunning(
const oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Returns True if the thread was created and has not terminated yet. Note that according to this definition a "running" thread might be suspended! Also returns False is Thread is NULL.

osl_joinWithThread
extern "C"
void osl_joinWithThread(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Blocks the calling thread until Thread has terminated. Returns immediately if Thread is NULL.

osl_resumeThread
extern "C"
void osl_resumeThread(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Wake-up a thread that was suspended with suspend() or createSuspended(). The oslThread must be valid!

osl_scheduleThread
extern "C"
sal_Bool osl_scheduleThread(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Offers the rest of the threads time-slice to the OS. scheduleThread() should be called in the working loop of the thread, so any other thread could also get the processor. Returns False if the thread should terminate, so the thread could free any allocated resources.

osl_setThreadKeyData
extern "C"
sal_Bool osl_setThreadKeyData(
oslThreadKey Key,
void * pData );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Set to key associated thread specific data.

osl_setThreadName
extern "C"
void osl_setThreadName(
const char * name );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Attempts to set the name of the current thread.
Description
The name of a thread is usually evaluated for debugging purposes. Not all platforms support this. On Linux, a set thread name can be observed with "ps -L". On Windows with the Microsoft compiler, a thread name set while a debugger is attached can be observed within the debugger.
Parameters
name
the name of the thread; must not be null; on Linux, only the
    first 16 characters are used

osl_setThreadPriority
extern "C"
void osl_setThreadPriority(
oslThread Thread,
oslThreadPriority Priority );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Changes the threads priority. The oslThread must be valid!

osl_setThreadTextEncoding
extern "C"
rtl_TextEncoding osl_setThreadTextEncoding(
rtl_TextEncoding Encoding );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Set the thread local text encoding.
Return
the old text encoding.

osl_suspendThread
extern "C"
void osl_suspendThread(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Suspend the execution of the thread. If you want the thread to continue, call resume(). The oslThread must be valid!

osl_terminateThread
extern "C"
void osl_terminateThread(
oslThread Thread );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
The requested thread will get terminate the next time scheduleThread() is called.

osl_waitThread
extern "C"
void osl_waitThread(
const TimeValue * pDelay );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Blocks the calling thread at least for the given number of time.

osl_yieldThread
extern "C"
void osl_yieldThread(
void );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Offers the rest of the threads time-slice to the OS. Under POSIX you _need_ to yield(), otherwise, since the threads are not preempted during execution, NO other thread (even with higher priority) gets the processor. Control is only given to another thread if the current thread blocks or uses yield().

Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.