What does bits contain if only BIT_1 is set in the event group before the call?
medium
A. Only BIT_1 set in bits
B. Both BIT_1 and BIT_2 set in bits
C. Zero (no bits set)
D. Function blocks indefinitely
Solution
Step 1: Understand wait mode pdFALSE
pdFALSE means OR mode: wait for any bit set.
Step 2: Check which bits are set before call
Only BIT_1 is set, but the third parameter is pdTRUE (clearOnExit), and the fourth parameter is pdFALSE (waitForAll = false), so the function waits for any bit set.
Step 3: Analyze the code
However, the third parameter is pdTRUE (clearOnExit), so bits are cleared on exit. But since waitForAll is pdFALSE, the function returns when any bit is set.
Step 4: But the question is what bits contains if only BIT_1 is set before call
Since waitForAll is false, the function returns immediately with bits containing BIT_1 set.
Final Answer:
Only BIT_1 set in bits -> Option A
Quick Check:
OR mode returns bits set among requested [OK]
Hint: pdFALSE means OR mode, returns any set bits [OK]