blob: ec9f1e0b26a8198761399cfb2e0e94344d091115 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/* atomic.h - wrapper for atomic gcc built-ins
*
* Copyright (C) 2009 Timo Teräs <timo.teras@iki.fi>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or later as
* published by the Free Software Foundation.
*
* See http://www.gnu.org/ for details.
*/
#ifndef TF_ATOMIC_H
#define TF_ATOMIC_H
#define tf_atomic_inc(var) __sync_add_and_fetch(&(var), 1)
#define tf_atomic_dec(var) __sync_add_and_fetch(&(var), -1)
#endif
|