LibreOffice
LibreOffice 5.0 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_OSL_THREAD_H
21 #define INCLUDED_OSL_THREAD_H
22 
23 #include <sal/config.h>
24 
25 #include <osl/time.h>
26 #include <rtl/textenc.h>
27 #include <sal/saldllapi.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 typedef void* oslThread;
38 
41 typedef void (SAL_CALL *oslWorkerFunction)(void*);
42 
48 typedef enum
49 {
55  osl_Thread_PriorityUnknown, /* don't use to set */
58 
59 
60 typedef sal_uInt32 oslThreadIdentifier;
61 
62 typedef void* oslThreadKey;
63 
71 SAL_DLLPUBLIC oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker, void* pThreadData);
72 
80 SAL_DLLPUBLIC oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker, void* pThreadData);
81 
86 SAL_DLLPUBLIC oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread);
87 
93 SAL_DLLPUBLIC void SAL_CALL osl_destroyThread(oslThread Thread);
94 
98 SAL_DLLPUBLIC void SAL_CALL osl_resumeThread(oslThread Thread);
99 
103 SAL_DLLPUBLIC void SAL_CALL osl_suspendThread(oslThread Thread);
104 
108 SAL_DLLPUBLIC void SAL_CALL osl_setThreadPriority(oslThread Thread, oslThreadPriority Priority);
109 
114 SAL_DLLPUBLIC oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread);
115 
120 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread);
121 
125 SAL_DLLPUBLIC void SAL_CALL osl_joinWithThread(oslThread Thread);
126 
130 SAL_DLLPUBLIC void SAL_CALL osl_waitThread(const TimeValue* pDelay);
131 
135 SAL_DLLPUBLIC void SAL_CALL osl_terminateThread(oslThread Thread);
136 
143 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread);
144 
152 SAL_DLLPUBLIC void SAL_CALL osl_yieldThread(void);
153 
164 SAL_DLLPUBLIC void SAL_CALL osl_setThreadName(char const * name);
165 
166 /* Callback when data stored in a thread key is no longer needed */
167 
168 typedef void (SAL_CALL *oslThreadKeyCallbackFunction)(void *);
169 
171 SAL_DLLPUBLIC oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback);
172 
174 SAL_DLLPUBLIC void SAL_CALL osl_destroyThreadKey(oslThreadKey Key);
175 
177 SAL_DLLPUBLIC void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key);
178 
180 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData);
181 
184 
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif // INCLUDED_OSL_THREAD_H
195 
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */