~arges/ubuntu/quantal/rsyslog/fix-lp1059592

« back to all changes in this revision

Viewing changes to atomic.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2009-02-15 21:56:23 UTC
  • mto: (3.2.4 squeeze) (1.1.9 upstream)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090215215623-xsycf628eo3kguc0
Tags: upstream-3.20.4
ImportĀ upstreamĀ versionĀ 3.20.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This header supplies atomic operations. So far, we rely on GCC's
2
 
 * atomic builtins. I have no idea if we can check them via autotools,
3
 
 * but I am making the necessary provisioning to live without them if
4
 
 * they are not available. Please note that you should only use the macros
5
 
 * here if you think you can actually live WITHOUT an explicit atomic operation,
6
 
 * because in the non-presence of them, we simply do it without atomicitiy.
7
 
 * Which, for word-aligned data types, usually (but only usually!) should work.
8
 
 *
9
 
 * We are using the functions described in
10
 
 * http:/gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html
11
 
 *
12
 
 * THESE MACROS MUST ONLY BE USED WITH WORD-SIZED DATA TYPES!
13
 
 *
14
 
 * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
15
 
 *
16
 
 * This file is part of rsyslog.
17
 
 *
18
 
 * Rsyslog is free software: you can redistribute it and/or modify
19
 
 * it under the terms of the GNU General Public License as published by
20
 
 * the Free Software Foundation, either version 3 of the License, or
21
 
 * (at your option) any later version.
22
 
 *
23
 
 * Rsyslog is distributed in the hope that it will be useful,
24
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 
 * GNU General Public License for more details.
27
 
 *
28
 
 * You should have received a copy of the GNU General Public License
29
 
 * along with Rsyslog.  If not, see <http://www.gnu.org/licenses/>.
30
 
 *
31
 
 * A copy of the GPL can be found in the file "COPYING" in this distribution.
32
 
 */
33
 
#include "config.h" /* autotools! */
34
 
 
35
 
#ifndef INCLUDED_ATOMIC_H
36
 
#define INCLUDED_ATOMIC_H
37
 
 
38
 
/* set the following to 1 if we have atomic operations (and #undef it otherwise) */
39
 
/* #define DO_HAVE_ATOMICS 1 */
40
 
/* for this release, we disable atomic calls because there seem to be some
41
 
 * portability problems and we can not fix that without destabilizing the build.
42
 
 * They simply came in too late. -- rgerhards, 2008-04-02
43
 
 */
44
 
/* make sure they are not used!
45
 
#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
46
 
#define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
47
 
*/
48
 
#define ATOMIC_INC(data) (++(data))
49
 
 
50
 
#endif /* #ifndef INCLUDED_ATOMIC_H */