N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## osSendMesg

Syntax

    #include <ultra64.h>

    s32 osSendMesg(
       OSMesgQueue *mq,
       OSMesg msg,
       s32 flag);

Explanation
The osCreateMesgQueue, osSendMesg, osJamMesg, and osRecvMesg functions are messaging and synchronization facilities.
Message queues provide a highly flexible communication and synchronization mechanism. The facilities are useful among threads, as well as between threads and events (primarily interrupts). See osSetEventMesg for a complete list of events.
The osSendMesg call copies the message (msg) to the end of the given message queue (mq). The flag argument specifies the blocking mode of this send operation. If flag is set to OS_MESG_BLOCK, the routine blocks on a full message queue; that is, the invoking thread yields the CPU until there is an empty slot in the queue for writing. This thread is enqueued onto a priority-linked list associated with the message queue behind other threads of the same priority. The osSendMesg call always returns 0 for a blocking send call. Setting flag to OS_MESG_NO_BLOCK allows the osSendMesg call to return immediately with a return value of -1 when the message queue is full. If the osSendMesg message queue is not full, the message is delivered and the call returns with a return value of 0. The osSendMesg call will resume the highest priority thread blocked in the osRecvMesg message queue that is waiting for the queue to become "not empty," if indeed one is blocked.
See Also
osCreateMesgQueue
osJamMesg
osRecvMes
osCreateThread
osSetEventMesg

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998