myMPD
Internal API documentation
Loading...
Searching...
No Matches
event.h File Reference

Event handling. More...

#include "compile_time.h"
#include <poll.h>
#include <stdbool.h>
Include dependency graph for event.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mympd_pfds
 

Enumerations

enum  pfd_type {
  PFD_TYPE_PARTITION = 0x1 , PFD_TYPE_STICKERDB = 0x2 , PFD_TYPE_TIMER = 0x4 , PFD_TYPE_QUEUE = 0x8 ,
  PFD_TYPE_TIMER_MPD_CONNECT = 0x10 , PFD_TYPE_TIMER_SCROBBLE = 0x20 , PFD_TYPE_TIMER_JUKEBOX = 0x40
}
 

Functions

void event_pfd_init (struct mympd_pfds *pfds)
 
bool event_pfd_add_fd (struct mympd_pfds *pfds, int fd, enum pfd_type type, struct t_partition_state *partition_state)
 
int event_eventfd_create (void)
 
bool event_eventfd_read (int fd)
 
bool event_eventfd_write (int fd)
 
void event_fd_close (int fd)
 
const char * lookup_pfd_type (enum pfd_type type)
 
const char * lookup_pfd_revents (short revent)
 

Detailed Description

Event handling.

Enumeration Type Documentation

◆ pfd_type

enum pfd_type

Poll fd types

Function Documentation

◆ event_eventfd_create()

int event_eventfd_create ( void  )

Creates an eventfd

Returns
the eventfd

◆ event_eventfd_read()

bool event_eventfd_read ( int  fd)

Reads from an eventfd

Parameters
fdread from this fd
Returns
true on success, else false

◆ event_eventfd_write()

bool event_eventfd_write ( int  fd)

Increments the eventfd by one

Parameters
fdfd to write
Returns
true on success, else false

◆ event_fd_close()

void event_fd_close ( int  fd)

Closes the fd

Parameters
fdfd to close

◆ event_pfd_add_fd()

bool event_pfd_add_fd ( struct mympd_pfds pfds,
int  fd,
enum pfd_type  type,
struct t_partition_state partition_state 
)

Adds an fd to poll

Parameters
pfdsstruct to add the fd
fdfd to add
typefd type to add
partition_statepointer to partition_state or NULL
Returns
true on success, else false

◆ event_pfd_init()

void event_pfd_init ( struct mympd_pfds pfds)

Initializes the mympd_pfds struct to zero

Parameters
pfdsstruct to initialize

◆ lookup_pfd_revents()

const char * lookup_pfd_revents ( short  revent)

Lookups the name for poll revents

Parameters
reventpoll return event
Returns
name as string

◆ lookup_pfd_type()

const char * lookup_pfd_type ( enum pfd_type  type)

Lookups the name for a pfd_type

Parameters
typepfd_type
Returns
name as string