libnx  v4.7.0
Data Structures | Enumerations | Functions
utimer.h File Reference

User-mode timer synchronization primitive. More...

#include "wait.h"

Go to the source code of this file.

Data Structures

struct  UTimer
 User-mode timer object. More...
 

Enumerations

enum  TimerType {
  TimerType_OneShot ,
  TimerType_Repeating
}
 Valid types for a user-mode timer. More...
 

Functions

static Waiter waiterForUTimer (UTimer *t)
 Creates a waiter for a user-mode timer.
 
void utimerCreate (UTimer *t, u64 interval, TimerType type)
 Creates a user-mode timer. More...
 
void utimerStart (UTimer *t)
 Starts the timer. More...
 
void utimerStop (UTimer *t)
 Stops the timer. More...
 

Detailed Description

User-mode timer synchronization primitive.

Author
plutoo

Enumeration Type Documentation

◆ TimerType

enum TimerType

Valid types for a user-mode timer.

Enumerator
TimerType_OneShot 

Timers of this kind fire once and then stop automatically.

TimerType_Repeating 

Timers of this kind fire periodically.

Function Documentation

◆ utimerCreate()

void utimerCreate ( UTimer t,
u64  interval,
TimerType  type 
)

Creates a user-mode timer.

Parameters
[out]tUTimer object.
[in]intervalInterval (in nanoseconds).
[in]typeType of timer to create (see TimerType).
Note
The timer is stopped when it is created. Use utimerStart to start it.
It is safe to wait on this timer with several threads simultaneously.
If more than one thread is listening on it, at least one thread will get the signal. No other guarantees.
For a repeating timer: If the timer triggers twice before you wait on it, you will only get one signal.

◆ utimerStart()

void utimerStart ( UTimer t)

Starts the timer.

Parameters
[in]tUTimer object.

◆ utimerStop()

void utimerStop ( UTimer t)

Stops the timer.

Parameters
[in]tUTimer object.