| 35 | } |
| 36 | |
| 37 | BOOL 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 | |
| 63 | BOOL OSJamMessage(OSMessageQueue* mq, OSMessage msg, s32 flags) { |
| 64 | BOOL enabled; |
nothing calls this directly
no test coverage detected