MySQL 9.1.0
Source Code Documentation
kqueue_timers.cc File Reference
#include <assert.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/event.h>
#include "my_sys.h"
#include "my_thread.h"
#include "my_timer.h"
#include "mysql/psi/mysql_thread.h"
#include "mysys_err.h"
#include "mysys_priv.h"

Functions

static void * timer_notify_thread_func (void *arg)
 Timer expiration notification thread. More...
 
static int start_helper_thread (void)
 Create a helper thread to dispatch timer expiration notifications. More...
 
int my_timer_initialize (void)
 Initialize internal components. More...
 
void my_timer_deinitialize (void)
 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...
 

Variables

static int kq_fd = -1
 
static my_thread_handle timer_notify_thread
 

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.

◆ start_helper_thread()

static int start_helper_thread ( void  )
static

Create a helper thread to dispatch timer expiration notifications.

Returns
On success, 0. On error, -1 is returned.

◆ timer_notify_thread_func()

static void * timer_notify_thread_func ( void *  arg)
static

Timer expiration notification thread.

Parameters
argUnused.

Variable Documentation

◆ kq_fd

int kq_fd = -1
static

◆ timer_notify_thread

my_thread_handle timer_notify_thread
static