19eab2a37SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 39eab2a37SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 49eab2a37SAndrew Rist * or more contributor license agreements. See the NOTICE file 59eab2a37SAndrew Rist * distributed with this work for additional information 69eab2a37SAndrew Rist * regarding copyright ownership. The ASF licenses this file 79eab2a37SAndrew Rist * to you under the Apache License, Version 2.0 (the 89eab2a37SAndrew Rist * "License"); you may not use this file except in compliance 99eab2a37SAndrew Rist * with the License. You may obtain a copy of the License at 109eab2a37SAndrew Rist * 119eab2a37SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 129eab2a37SAndrew Rist * 139eab2a37SAndrew Rist * Unless required by applicable law or agreed to in writing, 149eab2a37SAndrew Rist * software distributed under the License is distributed on an 159eab2a37SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169eab2a37SAndrew Rist * KIND, either express or implied. See the License for the 179eab2a37SAndrew Rist * specific language governing permissions and limitations 189eab2a37SAndrew Rist * under the License. 199eab2a37SAndrew Rist * 209eab2a37SAndrew Rist *************************************************************/ 219eab2a37SAndrew Rist 229eab2a37SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _OSL_SEMAPHORE_H_ 25cdf0e10cSrcweir #define _OSL_SEMAPHORE_H_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <sal/types.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifdef __cplusplus 30cdf0e10cSrcweir extern "C" { 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir 33cdf0e10cSrcweir typedef void* oslSemaphore; 34cdf0e10cSrcweir 35cdf0e10cSrcweir /** Creates a semaphore.<BR> 36cdf0e10cSrcweir 37cdf0e10cSrcweir @deprecated 38cdf0e10cSrcweir Must not be used, as unnamed semaphores are not supported on Mac OS X. 39cdf0e10cSrcweir 40cdf0e10cSrcweir @param InitialCount denotes the starting value the semaphore. If you set it to 41cdf0e10cSrcweir zero, the first acquire() blocks. Otherwise InitialCount acquire()s are 42*86e1cf34SPedro Giffuni immedeatly successful. 43cdf0e10cSrcweir @return 0 if the semaphore could not be created, otherwise a handle to the sem. 44cdf0e10cSrcweir */ 45cdf0e10cSrcweir oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount); 46cdf0e10cSrcweir 47cdf0e10cSrcweir /** Release the OS-structures and free semaphore data-structure 48cdf0e10cSrcweir 49cdf0e10cSrcweir @deprecated 50cdf0e10cSrcweir Must not be used, as unnamed semaphores are not supported on Mac OS X. 51cdf0e10cSrcweir 52cdf0e10cSrcweir @return fbbb 53cdf0e10cSrcweir */ 54cdf0e10cSrcweir void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore); 55cdf0e10cSrcweir 56cdf0e10cSrcweir /** acquire() decreases the count. It will block if it tries to 57cdf0e10cSrcweir decrease below zero. 58cdf0e10cSrcweir 59cdf0e10cSrcweir @deprecated 60cdf0e10cSrcweir Must not be used, as unnamed semaphores are not supported on Mac OS X. 61cdf0e10cSrcweir 62cdf0e10cSrcweir @return False if the system-call failed. 63cdf0e10cSrcweir */ 64cdf0e10cSrcweir sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore); 65cdf0e10cSrcweir 66cdf0e10cSrcweir /** tryToAcquire() tries to decreases the count. It will 67cdf0e10cSrcweir return with False if it would decrease the count below zero. 68cdf0e10cSrcweir (When acquire() would block.) If it could successfully 69cdf0e10cSrcweir decrease the count, it will return True. 70cdf0e10cSrcweir 71cdf0e10cSrcweir @deprecated 72cdf0e10cSrcweir Must not be used, as unnamed semaphores are not supported on Mac OS X. 73cdf0e10cSrcweir */ 74cdf0e10cSrcweir sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore); 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** release() increases the count. 77cdf0e10cSrcweir 78cdf0e10cSrcweir @deprecated 79cdf0e10cSrcweir Must not be used, as unnamed semaphores are not supported on Mac OS X. 80cdf0e10cSrcweir 81cdf0e10cSrcweir @return False if the system-call failed. 82cdf0e10cSrcweir */ 83cdf0e10cSrcweir sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore); 84cdf0e10cSrcweir 85cdf0e10cSrcweir #ifdef __cplusplus 86cdf0e10cSrcweir } 87cdf0e10cSrcweir #endif 88cdf0e10cSrcweir 89cdf0e10cSrcweir #endif /* _OSL_SEMAPHORE_H_ */ 90cdf0e10cSrcweir 91cdf0e10cSrcweir 92