design_pattern_for_c  V 1.00
tpool_event_if.h File Reference
Include dependency graph for tpool_event_if.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

event instance definition
typedef void * EventInstance
 Event management instance which get from event_if_new. More...
 
typedef void * EventHandler
 Event handler related to fd. More...
 

Functions

API for event if plugin interface
EventInstance event_if_new (void)
 new event instance More...
 
EventHandler event_if_add (EventInstance this, EventSubscriber subscriber, void *arg)
 add event handler related to fd More...
 
EventHandler event_if_update (EventInstance this, EventHandler handler, EventSubscriber subscriber, void *arg)
 update event handler related to fd More...
 
void event_if_del (EventInstance this, EventHandler handler)
 delete event handler related to fd More...
 
int event_if_getfd (EventHandler handler)
 get fd related to handler More...
 
int event_if_loop (EventInstance this)
 main loop, start to watch event More...
 
void event_if_loopbreak (EventInstance this)
 break main loop More...
 
void event_if_exit (EventInstance this)
 exit instances for loop, if plugin want. More...
 
void event_if_free (EventInstance this)
 free instances More...
 

Typedef Documentation

◆ EventHandler

typedef void* EventHandler

Event handler related to fd.

Definition is in plugin

Definition at line 15 of file tpool_event_if.h.

◆ EventInstance

typedef void* EventInstance

Event management instance which get from event_if_new.

Definition is in plugin

Definition at line 13 of file tpool_event_if.h.

Function Documentation

◆ event_if_add()

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

add event handler related to fd

Parameters
[in]thisEventInstance instance returned at event_if_new.
[in]subscriberEventSubscriber
[in]argargument for event_callback
Return values
!=NULLevent handler instance
NULLerror

add event handler related to fd

Definition at line 67 of file event_if_epoll.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ event_if_del()

void event_if_del ( EventInstance  this,
EventHandler  handler 
)

delete event handler related to fd

Parameters
[in]thisEventInstance instance returned at event_if_new.
[in]handlerEventHandler instance returned at event_if_add.
Returns
none

delete event handler related to fd

Definition at line 128 of file event_if_epoll.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ event_if_exit()

void event_if_exit ( EventInstance  this)

exit instances for loop, if plugin want.

Parameters
[in]thisEventInstance instance returned at event_if_new.
Returns
none

exit instances for loop, if plugin want.

Definition at line 190 of file event_if_epoll.c.

◆ event_if_free()

void event_if_free ( EventInstance  this)

free instances

Parameters
[in]thisEventInstance instance returned at event_if_new.
Returns
none

free instances

Definition at line 195 of file event_if_epoll.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 139 of file event_if_epoll.c.

◆ event_if_loop()

int event_if_loop ( EventInstance  this)

main loop, start to watch event

Parameters
[in]thisEventInstance instance returned at event_if_new.
Return values
0Normally stop
!=0Error stop
Note
this API brock thread as select, etc

main loop, start to watch event

Definition at line 144 of file event_if_epoll.c.

Here is the call graph for this function:

◆ event_if_loopbreak()

void event_if_loopbreak ( EventInstance  this)

break main loop

Parameters
[in]thisEventInstance instance returned at event_if_new.
Returns
none

break main loop

Definition at line 184 of file event_if_epoll.c.

◆ event_if_new()

EventInstance event_if_new ( void  )

new event instance

Parameters
[in]none
Return values
!=NULLthis class handle
NULLerror
Note
when call it, stop all threads.

new event instance

Definition at line 46 of file event_if_epoll.c.

Here is the call graph for this function:

◆ event_if_update()

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

update event handler related to fd

Parameters
[in]thisEventInstance instance returned at event_if_new.
[in]handlerEventHandler instance returned at event_if_add.
[in]subscriberEventSubscriber
[in]argargument for event_callback
Return values
!=NULLnew event handler instance
NULLerror

update event handler related to fd

Definition at line 105 of file event_if_epoll.c.

Here is the call graph for this function: