design_pattern_for_c  V 1.00
event_if_select.c File Reference
#include "tpool_event_if.h"
#include "dp_util.h"
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
Include dependency graph for event_if_select.c:

Go to the source code of this file.

Data Structures

struct  event_select_handler_t
 
struct  event_select_fds_t
 
struct  event_select_t
 

Macros

#define EVENT_SELECT_TIMEOUT   (50000)
 
#define event_select_handler_pull(this, data)   dputil_list_pull((DPUtilList)(this), (DPUtilListData)(data))
 
#define event_select_handler_insert(this, prev, data)   dputil_list_insert((DPUtilList)(this),(DPUtilListData)(prev), (DPUtilListData)(data))
 

Typedefs

typedef struct event_select_handler_t event_select_handler_t
 
typedef struct event_select_handler_tEventSelectHandler
 
typedef struct event_select_fds_t event_select_fds_t
 
typedef struct event_select_t event_select_t
 
typedef struct event_select_tEventSelect
 

Functions

static void event_select_reset_fds (event_select_fds_t *fds)
 
static void event_select_set_fds (EventSelect this, EventSubscriber subscriber)
 
static void event_select_unset_fds (EventSelect this, EventSubscriber subscriber)
 
static int event_select_get_eventflag_from_fds (EventSelect this, int fd)
 
API for event if
EventInstance event_if_new (void)
 event new More...
 
EventHandler event_if_add (EventInstance this, EventSubscriber subscriber, void *arg)
 add new event More...
 
void * event_if_update (EventInstance this, EventHandler handler, EventSubscriber subscriber, void *arg)
 update registered event More...
 
void event_if_del (EventInstance this, EventHandler handler)
 delete event More...
 
int event_if_getfd (EventHandler handler)
 get fd related to handler More...
 
int event_if_loop (EventInstance this)
 main loop of this event More...
 
void event_if_loopbreak (EventInstance this)
 break event More...
 
void event_if_exit (EventInstance this)
 exit after main loop More...
 
void event_if_free (EventInstance this)
 free event if instance More...
 

Macro Definition Documentation

◆ event_select_handler_insert

#define event_select_handler_insert (   this,
  prev,
  data 
)    dputil_list_insert((DPUtilList)(this),(DPUtilListData)(prev), (DPUtilListData)(data))

Definition at line 49 of file event_if_select.c.

◆ event_select_handler_pull

#define event_select_handler_pull (   this,
  data 
)    dputil_list_pull((DPUtilList)(this), (DPUtilListData)(data))

Definition at line 48 of file event_if_select.c.

◆ EVENT_SELECT_TIMEOUT

#define EVENT_SELECT_TIMEOUT   (50000)

Definition at line 10 of file event_if_select.c.

Typedef Documentation

◆ event_select_fds_t

◆ event_select_handler_t

Definition at line 13 of file event_if_select.c.

◆ event_select_t

Definition at line 46 of file event_if_select.c.

◆ EventSelect

typedef struct event_select_t * EventSelect

Definition at line 46 of file event_if_select.c.

◆ EventSelectHandler

Definition at line 13 of file event_if_select.c.

Function Documentation

◆ event_if_add()

EventHandler event_if_add ( EventInstance  this,
EventSubscriber  subscriber,
void *  arg 
)

add new event

add event handler related to fd

Definition at line 93 of file event_if_select.c.

Here is the call graph for this function:

◆ event_if_del()

void event_if_del ( EventInstance  this,
EventHandler  handler 
)

delete event

delete event handler related to fd

Definition at line 151 of file event_if_select.c.

Here is the call graph for this function:

◆ event_if_exit()

void event_if_exit ( EventInstance  this)

exit after main loop

exit instances for loop, if plugin want.

Definition at line 231 of file event_if_select.c.

◆ event_if_free()

void event_if_free ( EventInstance  this)

free event if instance

free instances

Definition at line 236 of file event_if_select.c.

Here is the caller graph for this function:

◆ event_if_getfd()

int event_if_getfd ( EventHandler  handler)

get fd related to handler

Parameters
[in]handlerEventHandler instance returned at event_if_add.
Returns
fd

Definition at line 173 of file event_if_select.c.

◆ event_if_loop()

int event_if_loop ( EventInstance  this)

main loop of this event

main loop, start to watch event

Definition at line 178 of file event_if_select.c.

Here is the call graph for this function:

◆ event_if_loopbreak()

void event_if_loopbreak ( EventInstance  this)

break event

break main loop

Definition at line 225 of file event_if_select.c.

◆ event_if_new()

EventInstance event_if_new ( void  )

event new

new event instance

Definition at line 76 of file event_if_select.c.

Here is the call graph for this function:

◆ event_if_update()

void* event_if_update ( EventInstance  this,
EventHandler  handler,
EventSubscriber  subscriber,
void *  arg 
)

update registered event

update event handler related to fd

Definition at line 131 of file event_if_select.c.

Here is the call graph for this function:

◆ event_select_get_eventflag_from_fds()

static int event_select_get_eventflag_from_fds ( EventSelect  this,
int  fd 
)
static

Definition at line 65 of file event_if_select.c.

Here is the caller graph for this function:

◆ event_select_reset_fds()

static void event_select_reset_fds ( event_select_fds_t fds)
inlinestatic

Definition at line 28 of file event_if_select.c.

Here is the caller graph for this function:

◆ event_select_set_fds()

static void event_select_set_fds ( EventSelect  this,
EventSubscriber  subscriber 
)
inlinestatic

Definition at line 51 of file event_if_select.c.

Here is the caller graph for this function:

◆ event_select_unset_fds()

static void event_select_unset_fds ( EventSelect  this,
EventSubscriber  subscriber 
)
inlinestatic

Definition at line 58 of file event_if_select.c.

Here is the caller graph for this function: