///@name Multithreading
///@{
+/// Reset types (for use with events and timers)
+typedef enum {
+ RESET_ONESHOT = 0, ///< When the primitive is signaled, it will wake up exactly one thread and will clear itself automatically.
+ RESET_STICKY = 1, ///< When the primitive is signaled, it will wake up all threads and it won't clear itself automatically.
+ RESET_PULSE = 2, ///< Only meaningful for timers: same as ONESHOT but it will periodically signal the timer instead of just once.
+} ResetType;
+
/// Types of thread info.
typedef enum {
THREADINFO_TYPE_UNKNOWN ///< Unknown.
/**
* @brief Creates an event handle.
* @param[out] event Pointer to output the created event handle to.
- * @param reset_type Type of reset the event uses.
+ * @param reset_type Type of reset the event uses (RESET_ONESHOT/RESET_STICKY).
*/
-Result svcCreateEvent(Handle* event, u8 reset_type);
+Result svcCreateEvent(Handle* event, ResetType reset_type);
/**
* @brief Signals an event.
* @param[out] timer Pointer to output the handle of the created timer to.
* @param reset_type Type of reset to perform on the timer.
*/
-Result svcCreateTimer(Handle* timer, u8 reset_type);
+Result svcCreateTimer(Handle* timer, ResetType reset_type);
/**
* @brief Sets a timer.
GSPGPU_AcquireRight(0x0);
//setup our gsp shared mem section
- svcCreateEvent(&gspEvent, 0x0);
+ svcCreateEvent(&gspEvent, RESET_ONESHOT);
GSPGPU_RegisterInterruptRelayQueue(gspEvent, 0x1, &gspSharedMemHandle, &gfxThreadID);
svcMapMemoryBlock(gspSharedMemHandle, (u32)gfxSharedMemory, 0x3, 0x10000000);
rc = ndspLoadComponent();
if (R_FAILED(rc)) return rc;
- rc = svcCreateEvent(&irqEvent, 1);
+ rc = svcCreateEvent(&irqEvent, RESET_STICKY);
if (R_FAILED(rc)) goto _fail1;
rc = DSP_RegisterInterruptEvents(irqEvent, 2, 2);
rc = ndspInitialize(false);
if (R_FAILED(rc)) goto _fail1;
- rc = svcCreateEvent(&sleepEvent, 0);
+ rc = svcCreateEvent(&sleepEvent, RESET_STICKY);
if (R_FAILED(rc)) goto _fail2;
ndspThread = threadCreate(ndspThreadMain, 0x0, NDSP_THREAD_STACK_SIZE, 0x18, -2, true);
int i;
for (i = 0; i < GSPGPU_EVENT_MAX; i ++)
{
- Result rc = svcCreateEvent(&gspEvents[i], 0);
+ Result rc = svcCreateEvent(&gspEvents[i], RESET_STICKY);
if (rc != 0)
{
// Destroy already created events due to failure
if(maxsize < sizeof(nwmBeaconDataReplyHeader))return -2;
- ret = svcCreateEvent(&event, 0);
+ ret = svcCreateEvent(&event, RESET_ONESHOT);
if(R_FAILED(ret))return ret;
if(!connected)ret = udsipc_RecvBeaconBroadcastData(outbuf, maxsize, &scaninput, wlancommID, id8, event);