wut  1.0.0-beta9
Wii U Toolchain
event.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include "thread.h"
4 #include "threadqueue.h"
5 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 typedef struct OSEvent OSEvent;
21 
22 typedef enum OSEventMode
23 {
26 
29 } OSEventMode;
30 
31 #define OS_EVENT_TAG 0x65566E54u
32 
33 struct OSEvent
34 {
36  uint32_t tag;
37 
39  const char *name;
40 
41  WUT_UNKNOWN_BYTES(4);
42 
45 
48 
51 };
52 WUT_CHECK_OFFSET(OSEvent, 0x0, tag);
53 WUT_CHECK_OFFSET(OSEvent, 0x4, name);
54 WUT_CHECK_OFFSET(OSEvent, 0xc, value);
55 WUT_CHECK_OFFSET(OSEvent, 0x10, queue);
56 WUT_CHECK_OFFSET(OSEvent, 0x20, mode);
57 WUT_CHECK_SIZE(OSEvent, 0x24);
58 
59 
63 void
64 OSInitEvent(OSEvent *event,
65  BOOL value,
66  OSEventMode mode);
67 
68 
72 void
73 OSInitEventEx(OSEvent *event,
74  BOOL value,
75  OSEventMode mode,
76  char *name);
77 
78 
92 void
93 OSSignalEvent(OSEvent *event);
94 
106 void
107 OSSignalEventAll(OSEvent *event);
108 
109 
120 void
121 OSWaitEvent(OSEvent *event);
122 
123 
129 void
130 OSResetEvent(OSEvent *event);
131 
132 
138 BOOL
140  OSTime timeout);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
OSTime
int64_t OSTime
Definition: time.h:18
OSEvent::value
BOOL value
The current value of the event object.
Definition: event.h:44
OS_EVENT_MODE_AUTO
@ OS_EVENT_MODE_AUTO
An auto event will reset everytime a thread is woken.
Definition: event.h:28
OSSignalEventAll
void OSSignalEventAll(OSEvent *event)
Signals all threads waiting on an event.
threadqueue.h
OSSignalEvent
void OSSignalEvent(OSEvent *event)
Signals the event.
OSEventMode
OSEventMode
Definition: event.h:22
OSEvent
Definition: event.h:33
OSEvent::mode
OSEventMode mode
The mode of the event object, set by OSInitEvent.
Definition: event.h:50
wut.h
OSInitEventEx
void OSInitEventEx(OSEvent *event, BOOL value, OSEventMode mode, char *name)
Initialise an event object with value, mode and name.
OSInitEvent
void OSInitEvent(OSEvent *event, BOOL value, OSEventMode mode)
Initialise an event object with value and mode.
OSEvent::queue
OSThreadQueue queue
The threads currently waiting on this event object with OSWaitEvent.
Definition: event.h:47
OSEvent::name
const char * name
Name set by OSInitEventEx.
Definition: event.h:39
OSWaitEvent
void OSWaitEvent(OSEvent *event)
Wait until an event is signalled.
OS_EVENT_MODE_MANUAL
@ OS_EVENT_MODE_MANUAL
A manual event will only reset when OSResetEvent is called.
Definition: event.h:25
OSWaitEventWithTimeout
BOOL OSWaitEventWithTimeout(OSEvent *event, OSTime timeout)
Wait until an event is signalled or a timeout has occurred.
BOOL
int32_t BOOL
Definition: wut_types.h:4
OSThreadQueue
Definition: threadqueue.h:29
OSResetEvent
void OSResetEvent(OSEvent *event)
Resets the event object.
OSEvent::tag
uint32_t tag
Should always be set to the value OS_EVENT_TAG.
Definition: event.h:36
thread.h