The first commit

This commit is contained in:
Banjo Kazooie
2022-07-15 17:09:41 -05:00
commit dd13d34074
1087 changed files with 391897 additions and 0 deletions

32
src/done/recvmesg.c Normal file
View File

@@ -0,0 +1,32 @@
#include <ultra64.h>
#include "osint.h"
s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags)
{
register u32 saveMask;
saveMask = __osDisableInt();
while (MQ_IS_EMPTY(mq))
{
if (flags == OS_MESG_NOBLOCK)
{
__osRestoreInt(saveMask);
return -1;
}
__osRunningThread->state = OS_STATE_WAITING;
__osEnqueueAndYield(&mq->mtqueue);
}
if (msg != NULL)
{
*msg = mq->msg[mq->first];
}
mq->first = (mq->first + 1) % mq->msgCount;
mq->validCount--;
if (mq->fullqueue->next != NULL)
{
osStartThread(__osPopThread(&mq->fullqueue));
}
__osRestoreInt(saveMask);
return 0;
}