12 #ifndef __UT_ABORTABLELOCK_H_INCLUDED__
13 #define __UT_ABORTABLELOCK_H_INCLUDED__
25 namespace UT_AbortableLockImpl
38 void markAsLocked(
int thread_id);
39 void markAsUnlocked();
41 void markAsWaiting(
int thread_id);
42 void markAsNotWaiting(
int thread_id);
44 bool findDeadlock(
int thread_id);
52 void markDeadlock(
int thread_id);
54 static bool getPrintDeadlocks();
55 static void setPrintDeadlocks(
bool flag);
57 static bool runUnitTest(
bool print_progress,
58 bool for_performance);
75 static bool thePrintDeadlocks;
83 template <
typename LOCKABLE>
116 UT_AbortableLockImpl::LockState myImpl;
134 #endif // __UT_ABORTABLELOCK_H_INCLUDED__
bool safeLock()
Attempt lock on this mutex. Returns true on success, false if deadlock.
void unlock()
Release lock. Undefined if it was not previously locked.
Lock adapter for std mutexes.
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
bool tryLock()
Tries the lock without blocking. Returns true if the lock was obtained.
**Note that the tasks the thread_id
void lock()
Locks the underlying mutex without testing for deadlocks.