LLVM: include/llvm/Support/Mutex.h Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_SUPPORT_MUTEX_H

14#define LLVM_SUPPORT_MUTEX_H

15

17#include

18#include

19

21{

22 namespace sys

23 {

24

25

26

27 template<bool mt_only>

29 std::recursive_mutex impl;

30 unsigned acquired = 0;

31

32 public:

35 impl.lock();

36 return true;

37 }

38

39

40

41 ++acquired;

42 return true;

43 }

44

47 impl.unlock();

48 return true;

49 }

50

51

52

53 assert(acquired && "Lock not acquired before release!");

54 --acquired;

55 return true;

56 }

57

60 return impl.try_lock();

61 return true;

62 }

63 };

64

65

67

68 template <bool mt_only>

70

72 }

73}

74

75#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...

Definition Mutex.h:28

bool lock()

Definition Mutex.h:33

bool try_lock()

Definition Mutex.h:58

bool unlock()

Definition Mutex.h:45

std::lock_guard< SmartMutex< mt_only > > SmartScopedLock

Definition Mutex.h:69

SmartMutex< false > Mutex

Mutex - A standard, always enforced mutex.

Definition Mutex.h:66

SmartScopedLock< false > ScopedLock

Definition Mutex.h:71

This is an optimization pass for GlobalISel generic memory operations.

constexpr bool llvm_is_multithreaded()

Returns true if LLVM is compiled with support for multi-threading, and false otherwise.