MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
spinlocks.h
Go to the documentation of this file.
1 #ifndef __SPINLOCKS_H
2 #define __SPINLOCKS_H
3 /* Manages particle locking:
4  * init_spinlocks allocates and initialises an array of spinlocks.
5  * free_spinlocks destroys and frees them.
6  * (un)lock_spinlock locks and unlocks the i'th spinlock.
7  * try_lock_spinlock trys to lock the particle, returning 0 on success.
8  * Warning! If NO_OPENMP_SPINLOCK is defined, these functions do nothing!*/
9 
10 struct SpinLocks;
11 
12 struct SpinLocks * init_spinlocks(int NumLock);
13 void free_spinlocks(struct SpinLocks * spin);
14 void lock_spinlock(int i, struct SpinLocks * spin);
15 void unlock_spinlock(int i, struct SpinLocks * spin);
16 int try_lock_spinlock(int i, struct SpinLocks * spin);
17 #endif
static struct SpinLocks spin
Definition: spinlocks.c:21
void free_spinlocks(struct SpinLocks *spin)
Definition: spinlocks.c:70
int try_lock_spinlock(int i, struct SpinLocks *spin)
Definition: spinlocks.c:38
void lock_spinlock(int i, struct SpinLocks *spin)
Definition: spinlocks.c:23
struct SpinLocks * init_spinlocks(int NumLock)
Definition: spinlocks.c:49
void unlock_spinlock(int i, struct SpinLocks *spin)
Definition: spinlocks.c:30