| 10 | } |
| 11 | |
| 12 | BOOL OSSendMessage(OSMessageQueue* mq, OSMessage msg, s32 flags) { |
| 13 | BOOL enabled; |
| 14 | s32 lastIndex; |
| 15 | |
| 16 | enabled = OSDisableInterrupts(); |
| 17 | |
| 18 | while (mq->msgCount <= mq->usedCount) { |
| 19 | if (!(flags & OS_MESSAGE_BLOCK)) { |
| 20 | OSRestoreInterrupts(enabled); |
| 21 | return FALSE; |
| 22 | } else { |
| 23 | OSSleepThread(&mq->queueSend); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | lastIndex = (mq->firstIndex + mq->usedCount) % mq->msgCount; |
| 28 | mq->msgArray[lastIndex] = msg; |
| 29 | mq->usedCount++; |
| 30 | |
| 31 | OSWakeupThread(&mq->queueReceive); |
| 32 | |
| 33 | OSRestoreInterrupts(enabled); |
| 34 | return TRUE; |
| 35 | } |
| 36 | |
| 37 | BOOL OSReceiveMessage(OSMessageQueue* mq, OSMessage* msg, s32 flags) { |
| 38 | BOOL enabled; |
nothing calls this directly
no test coverage detected