Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / osl / mutex.h
blobefc619d282a486375bc78f2f2eae4119272f5257
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 * This file is part of LibreOffice published API.
24 #ifndef INCLUDED_OSL_MUTEX_H
25 #define INCLUDED_OSL_MUTEX_H
27 #include "sal/config.h"
29 #include "sal/saldllapi.h"
30 #include "sal/types.h"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 struct _oslMutexImpl;
37 typedef struct _oslMutexImpl * oslMutex;
39 /** Create a mutex.
41 @return 0 if the mutex could not be created, otherwise a handle to the mutex.
43 SAL_DLLPUBLIC oslMutex SAL_CALL osl_createMutex(void);
45 /** Release the OS-structures and free mutex data-structure.
47 @param Mutex the mutex-handle
49 SAL_DLLPUBLIC void SAL_CALL osl_destroyMutex(oslMutex Mutex);
51 /** Acquire the mutex, block if already acquired by another thread.
52 @param Mutex handle to a created mutex.
53 @retval False if system-call fails.
55 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_acquireMutex(oslMutex Mutex);
57 /** Try to acquire the mutex without blocking.
59 @param Mutex handle to a created mutex.
61 @retval False if it could not be acquired.
63 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex Mutex);
65 /** Release the mutex.
67 @param Mutex handle to a created mutex.
68 @retval False if system-call fails.
70 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex);
72 /** Returns a unique and global mutex.
74 @return the global mutex.
76 SAL_DLLPUBLIC oslMutex * SAL_CALL osl_getGlobalMutex(void);
78 #ifdef __cplusplus
80 #endif
82 #endif // INCLUDED_OSL_MUTEX_H
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */