![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Atomic operations. More...
#include <stdbool.h>#include <stdint.h>
Include dependency graph for atomic.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | atomic_t |
| struct | spinlock_t |
Macros | |
| #define | atomic_read(v) ((v)->count) |
| Read operation on an atomic counter. | |
| #define | atomic_set(v, i) (((v)->count) = (i)) |
| Set operation on an atomic counter. | |
| #define | spinlock_init(s) ((s)->lock = 0) |
| Spinlock initialization. | |
Functions | |
| bool | iCAS (volatile uint32_t *ptr, uint32_t oldVal, uint32_t newVal) |
| int | atomic_test_and_set (int *) |
| void | atomic_inc (atomic_t *) |
| void | atomic_dec (atomic_t *) |
| int | atomic_inc_and_test (atomic_t *v) |
| bool | spin_trylock (spinlock_t *s) |
| void | spin_unlock (spinlock_t *s) |
| void | spin_lock (spinlock_t *s) |
Atomic operations.
This module implements atomic and non-blocking operations used within ROOT-Sim to coordinate threads and processes (on shared memory).
This file is part of ROOT-Sim (ROme OpTimistic Simulator).
ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.
ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file atomic.h.
|
inline |
|
inline |
|
inline |
This function implements (on x86-64 architectures) the atomic dec operation. It decrements the atomic counter 'v' by 1 unit
| v | the atomic counter which is the destination of the operation |
Definition at line 118 of file x86.c.
Here is the caller graph for this function:
|
inline |
|
inline |
This function implements a compare-and-swap atomic operation on x86-64 for integers
| ptr | the address where to perform the CAS operation on |
| oldVal | the old value we expect to find before swapping |
| newVal | the new value to place in ptr if ptr contains oldVal |
Definition at line 49 of file x86.c.
Here is the caller graph for this function:
|
inline |
|
inline |
|
inline |