Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
scoped_spin_lock.h
Go to the documentation of this file.
1#ifndef HALIDE_SCOPED_SPIN_LOCK_H
2#define HALIDE_SCOPED_SPIN_LOCK_H
3
4namespace Halide {
5namespace Runtime {
6namespace Internal {
7
8// An RAII spin lock.
10 // Note that __atomic_test_and_set() requires use of a char (or bool)
11 typedef char AtomicFlag;
12
13 volatile AtomicFlag *const flag;
14
16 : flag(flag) {
17 while (__atomic_test_and_set(flag, __ATOMIC_ACQUIRE)) {
18 // nothing
19 }
20 }
21
23 __atomic_clear(flag, __ATOMIC_RELEASE);
24 }
25};
26
27} // namespace Internal
28} // namespace Runtime
29} // namespace Halide
30
31#endif
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
#define ALWAYS_INLINE
ALWAYS_INLINE ScopedSpinLock(volatile AtomicFlag *flag)