MCPcopy Create free account
hub / github.com/ARMmbed/DAPLink / ThreadFlagsCheck

Function ThreadFlagsCheck

source/rtos2/RTX/Source/rtx_thread.c:96–134  ·  view source on GitHub ↗

Check Thread Flags. \param[in] thread thread object. \param[in] flags specifies the flags to check. \param[in] options specifies flags options (osFlagsXxxx). \return thread flags before clearing or 0 if specified flags have not been set.

Source from the content-addressed store, hash-verified

94/// \param[in] options specifies flags options (osFlagsXxxx).
95/// \return thread flags before clearing or 0 if specified flags have not been set.
96static uint32_t ThreadFlagsCheck (os_thread_t *thread, uint32_t flags, uint32_t options) {
97#if (EXCLUSIVE_ACCESS == 0)
98 uint32_t primask;
99#endif
100 uint32_t thread_flags;
101
102 if ((options & osFlagsNoClear) == 0U) {
103#if (EXCLUSIVE_ACCESS == 0)
104 primask = __get_PRIMASK();
105 __disable_irq();
106
107 thread_flags = thread->thread_flags;
108 if ((((options & osFlagsWaitAll) != 0U) && ((thread_flags & flags) != flags)) ||
109 (((options & osFlagsWaitAll) == 0U) && ((thread_flags & flags) == 0U))) {
110 thread_flags = 0U;
111 } else {
112 thread->thread_flags &= ~flags;
113 }
114
115 if (primask == 0U) {
116 __enable_irq();
117 }
118#else
119 if ((options & osFlagsWaitAll) != 0U) {
120 thread_flags = atomic_chk32_all(&thread->thread_flags, flags);
121 } else {
122 thread_flags = atomic_chk32_any(&thread->thread_flags, flags);
123 }
124#endif
125 } else {
126 thread_flags = thread->thread_flags;
127 if ((((options & osFlagsWaitAll) != 0U) && ((thread_flags & flags) != flags)) ||
128 (((options & osFlagsWaitAll) == 0U) && ((thread_flags & flags) == 0U))) {
129 thread_flags = 0U;
130 }
131 }
132
133 return thread_flags;
134}
135
136
137// ==== Library functions ====

Callers 3

osRtxThreadPostProcessFunction · 0.85
svcRtxThreadFlagsSetFunction · 0.85
svcRtxThreadFlagsWaitFunction · 0.85

Calls 5

__disable_irqFunction · 0.85
__enable_irqFunction · 0.85
atomic_chk32_allFunction · 0.85
atomic_chk32_anyFunction · 0.85
__get_PRIMASKFunction · 0.50

Tested by

no test coverage detected