MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / OSReceiveMessage

Function OSReceiveMessage

src/dolphin/src/os/OSMessage.c:37–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37BOOL OSReceiveMessage(OSMessageQueue* mq, OSMessage* msg, s32 flags) {
38 BOOL enabled;
39
40 enabled = OSDisableInterrupts();
41
42 while (mq->usedCount == 0) {
43 if (!(flags & OS_MESSAGE_BLOCK)) {
44 OSRestoreInterrupts(enabled);
45 return FALSE;
46 } else {
47 OSSleepThread(&mq->queueReceive);
48 }
49 }
50
51 if (msg != NULL) {
52 *msg = mq->msgArray[mq->firstIndex];
53 }
54 mq->firstIndex = (mq->firstIndex + 1) % mq->msgCount;
55 mq->usedCount--;
56
57 OSWakeupThread(&mq->queueSend);
58
59 OSRestoreInterrupts(enabled);
60 return TRUE;
61}
62
63BOOL OSJamMessage(OSMessageQueue* mq, OSMessage msg, s32 flags) {
64 BOOL enabled;

Callers

nothing calls this directly

Calls 3

OSDisableInterruptsFunction · 0.85
OSSleepThreadFunction · 0.85
OSWakeupThreadFunction · 0.85

Tested by

no test coverage detected