UDK 3.2.7 C/C++ API Reference

osl/interlck.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 
00020 #ifndef _OSL_INTERLOCK_H_
00021 #define _OSL_INTERLOCK_H_
00022 
00023 #include "sal/config.h"
00024 
00025 #include "sal/saldllapi.h"
00026 #include "sal/types.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 typedef sal_Int32 oslInterlockedCount;
00033 
00038 SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount);
00039 
00044 SAL_DLLPUBLIC oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount);
00045 
00046 
00048 
00059 #if defined( HAVE_GCC_BUILTIN_ATOMIC )
00060 #    define osl_atomic_increment(p)  __sync_add_and_fetch((p), 1)
00061 #else
00062 #    define osl_atomic_increment(p) osl_incrementInterlockedCount((p))
00063 #endif
00064 
00065 
00076 #if defined( HAVE_GCC_BUILTIN_ATOMIC )
00077 #    define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
00078 #else
00079 #    define osl_atomic_decrement(p) osl_decrementInterlockedCount((p))
00080 #endif
00081 
00083 
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087 
00088 
00089 #endif  /* _OSL_INTERLOCK_H_ */
00090 
00091 
00092 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines