MySQL 8.0.39
Source Code Documentation
posix_timers.cc File Reference
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <sys/time.h>
#include "my_timer.h"

Functions

static void timer_notify_thread_func (sigval arg)
 Timer expiration notification thread. More...
 
int my_timer_initialize ()
 Initialize internal components. More...
 
void my_timer_deinitialize ()
 Release any resources that were allocated as part of initialization. More...
 
int my_timer_create (my_timer_t *timer)
 Create a timer object. More...
 
int my_timer_set (my_timer_t *timer, unsigned long time)
 Set the time until the next expiration of the timer. More...
 
int my_timer_cancel (my_timer_t *timer, int *state)
 Cancel the timer. More...
 
void my_timer_delete (my_timer_t *timer)
 Delete a timer object. More...
 

Function Documentation

◆ my_timer_cancel()

int my_timer_cancel ( my_timer_t timer,
int *  state 
)

Cancel the timer.

Parameters
timerTimer object.
stateThe state of the timer at the time of cancellation, either signaled (false) or nonsignaled (true).
Returns
On success, 0. On error, -1 is returned, and errno is set to indicate the error.

◆ my_timer_create()

int my_timer_create ( my_timer_t timer)

Create a timer object.

Parameters
timerLocation where the timer ID is returned.
Returns
On success, 0. On error, -1 is returned, and errno is set to indicate the error.

◆ my_timer_deinitialize()

void my_timer_deinitialize ( void  )

Release any resources that were allocated as part of initialization.

◆ my_timer_delete()

void my_timer_delete ( my_timer_t timer)

Delete a timer object.

Parameters
timerTimer object.

◆ my_timer_initialize()

int my_timer_initialize ( void  )

Initialize internal components.

Returns
On success, 0. On error, -1 is returned, and errno is set to indicate the error.

◆ my_timer_set()

int my_timer_set ( my_timer_t timer,
unsigned long  time 
)

Set the time until the next expiration of the timer.

Parameters
timerTimer object.
timeAmount of time (in milliseconds) before the timer expires.
Returns
On success, 0. On error, -1 is returned, and errno is set to indicate the error.

◆ timer_notify_thread_func()

static void timer_notify_thread_func ( sigval  arg)
static

Timer expiration notification thread.

Parameters
argEvent info.