summaryrefslogtreecommitdiff
path: root/include/dolphin/os/OSMessage.h
blob: f67a84e389eb3c54b377ea3474cd03ba854ca8fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef _DOLPHIN_OSMESSAGE
#define _DOLPHIN_OSMESSAGE

#ifdef __cplusplus
extern "C" {
#endif

#include <dolphin/os/OSThread.h>
typedef struct OSMessageQueue OSMessageQueue;
typedef void* OSMessage;

struct OSMessageQueue {
  OSThreadQueue queueSend;
  OSThreadQueue queueReceive;
  OSMessage* msgArray;
  s32 msgCount;
  s32 firstIndex;
  s32 usedCount;
};

// Flags to turn blocking on/off when sending/receiving message
#define OS_MESSAGE_NOBLOCK 0
#define OS_MESSAGE_BLOCK 1

void OSInitMessageQueue(OSMessageQueue* mq, OSMessage* msgArray, s32 msgCount);
BOOL OSSendMessage(OSMessageQueue* mq, OSMessage msg, s32 flags);
BOOL OSJamMessage(OSMessageQueue* mq, OSMessage msg, s32 flags);
BOOL OSReceiveMessage(OSMessageQueue* mq, OSMessage* msg, s32 flags);

#ifdef __cplusplus
}
#endif

#endif // _DOLPHIN_OSMESSAGE