Update ooo320-m1
[ooovba.git] / sal / inc / osl / mutex.h
blob948da10b20f8ff241eff4ddf67412b4aa8d752ae
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mutex.h,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _OSL_MUTEX_H_
32 #define _OSL_MUTEX_H_
34 #include <sal/types.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 struct _oslMutexImpl;
41 typedef struct _oslMutexImpl * oslMutex;
43 /** Create a thread-local mutex.
44 @return 0 if the mutex could not be created, otherwise a handle to the mutex.
46 oslMutex SAL_CALL osl_createMutex(void);
48 /** Release the OS-structures and free mutex data-structure.
49 @param Mutex the mutex-handle
51 void SAL_CALL osl_destroyMutex(oslMutex Mutex);
53 /** Acquire the mutex, block if already acquired by another thread.
54 @param Mutex handle to a created mutex.
55 @return False if system-call fails.
57 sal_Bool SAL_CALL osl_acquireMutex(oslMutex Mutex);
59 /** Try to acquire the mutex without blocking.
60 @param Mutex handle to a created mutex.
61 @return False if it could not be acquired.
63 sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex Mutex);
65 /** Release the mutex.
66 @param Mutex handle to a created mutex.
67 @return False if system-call fails.
69 sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex);
71 /** Returns a unique and global mutex.
72 @return the global mutex.
74 oslMutex * SAL_CALL osl_getGlobalMutex(void);
76 #ifdef __cplusplus
78 #endif
80 #endif /* _OSL_MUTEX_H_ */