20 #ifndef GALOIS_RUNTIME_CONTEXT_H
21 #define GALOIS_RUNTIME_CONTEXT_H
26 #include <boost/utility.hpp>
28 #include "galois/config.h"
30 #ifdef GALOIS_USE_LONGJMP_ABORT
48 extern thread_local std::jmp_buf
execFrame;
53 #if defined(GALOIS_USE_LONGJMP_ABORT)
56 #elif defined(GALOIS_USE_EXCEPTION_ABORT)
66 #if defined(GALOIS_USE_LONGJMP_ABORT)
69 #elif defined(GALOIS_USE_EXCEPTION_ABORT)
75 static inline void clearConflictLock() {}
77 class LockManagerBase;
103 assert(lockable !=
nullptr);
104 return lockable->owner.stealing_CAS(other,
this);
108 assert(lockable !=
nullptr);
109 return lockable->owner.CAS(other,
this);
113 assert(lockable !=
nullptr);
114 assert(!lockable->owner.getValue());
115 lockable->owner.setValue(
this);
119 assert(lockable !=
nullptr);
121 lockable->owner.unlock_and_clear();
125 assert(lockable !=
nullptr);
126 return lockable->owner.try_lock();
130 assert(lockable !=
nullptr);
131 return lockable->owner.getValue();
151 assert(!lockable->next);
152 lockable->next = locks;
160 }
else if ((i =
tryAcquire(lockable)) != AcquireStatus::FAIL) {
161 if (i == AcquireStatus::NEW_OWNER) {
Definition: libgalois/include/galois/runtime/Context.h:45
unsigned cancelIteration()
Definition: Context.cpp:92
static SimpleRuntimeContext * getOwner(Lockable *lockable)
Definition: libgalois/include/galois/runtime/Context.h:143
void setOwner(Lockable *lockable)
Definition: libgalois/include/galois/runtime/Context.h:112
PtrLock is a spinlock and a pointer.
Definition: PtrLock.h:42
void setThreadContext(SimpleRuntimeContext *n)
used by the parallel code to set up conflict detection per thread
Definition: Context.cpp:31
thread_local std::jmp_buf execFrame
Definition: Context.cpp:29
bool CASowner(Lockable *lockable, LockManagerBase *other)
Definition: libgalois/include/galois/runtime/Context.h:107
void release(Lockable *lockable)
Definition: libgalois/include/galois/runtime/Context.h:118
void signalFailSafe(void)
Definition: libgalois/include/galois/runtime/Context.h:65
Definition: libgalois/include/galois/runtime/Context.h:98
Definition: libgalois/include/galois/runtime/Context.h:98
bool shouldLock(const galois::MethodFlag g)
Helper function to decide if the conflict detection lock should be taken.
Definition: libgalois/include/galois/runtime/Context.h:189
Definition: libgalois/include/galois/runtime/Context.h:229
Lockable()
Definition: libgalois/include/galois/runtime/Context.h:93
void addToNhood(Lockable *lockable)
Definition: libgalois/include/galois/runtime/Context.h:150
void doAcquire(Lockable *lockable, galois::MethodFlag m)
actual locking function. Will always lock.
Definition: libgalois/include/galois/runtime/Context.h:210
All objects that may be locked (nodes primarily) must inherit from Lockable.
Definition: libgalois/include/galois/runtime/Context.h:83
Definition: libgalois/include/galois/runtime/Context.h:98
Definition: libgalois/include/galois/runtime/Context.h:223
virtual ~SimpleRuntimeContext()
Definition: libgalois/include/galois/runtime/Context.h:173
Definition: libgalois/include/galois/runtime/Context.h:96
SimpleRuntimeContext(bool child=false)
Definition: libgalois/include/galois/runtime/Context.h:172
virtual void subAcquire(Lockable *lockable, galois::MethodFlag m)
Definition: Context.cpp:96
static LockManagerBase * getOwner(Lockable *lockable)
Definition: libgalois/include/galois/runtime/Context.h:129
bool stealByCAS(Lockable *lockable, LockManagerBase *other)
Definition: libgalois/include/galois/runtime/Context.h:102
galois::MethodFlag m
Definition: libgalois/include/galois/runtime/Context.h:230
void startIteration()
Definition: libgalois/include/galois/runtime/Context.h:175
void signalConflict(Lockable *=nullptr)
Definition: libgalois/include/galois/runtime/Context.h:52
void release(Lockable *lockable)
Definition: Context.cpp:67
ConflictFlag
Definition: libgalois/include/galois/runtime/Context.h:41
void acquire(Lockable *lockable, galois::MethodFlag m)
Master function which handles conflict detection used to acquire a lockable thing.
Definition: libgalois/include/galois/runtime/Context.h:218
AcquireStatus
Definition: libgalois/include/galois/runtime/Context.h:98
MethodFlag
What should the runtime do when executing a method.
Definition: MethodFlags.h:34
friend void doAcquire(Lockable *, galois::MethodFlag)
actual locking function. Will always lock.
Definition: libgalois/include/galois/runtime/Context.h:210
static bool tryLock(Lockable *lockable)
Definition: libgalois/include/galois/runtime/Context.h:124
Definition: libgalois/include/galois/runtime/Context.h:135
void operator()(Lockable *lockable) const
Definition: libgalois/include/galois/runtime/Context.h:224
AcquireStatus tryAcquire(Lockable *lockable)
Definition: Context.cpp:45
Definition: libgalois/include/galois/runtime/Context.h:42
Definition: libgalois/include/galois/runtime/Context.h:43
void acquire(Lockable *lockable, galois::MethodFlag m)
Definition: libgalois/include/galois/runtime/Context.h:156
CheckedLockObj(galois::MethodFlag _m)
Definition: libgalois/include/galois/runtime/Context.h:231
SimpleRuntimeContext * getThreadContext()
get the current conflict detection class, may be null if not in parallel region
Definition: Context.cpp:36
Definition: libgalois/include/galois/runtime/Context.h:44
unsigned commitIteration()
Definition: Context.cpp:77
void operator()(Lockable *lockable) const
Definition: libgalois/include/galois/runtime/Context.h:232