PUBLIC: event interface functions

handle different aspects of the MqS event-queue More...


Typedefs

typedef void(* MqEventF )(struct MqS *const )
 prototype for a Event-Checking function

Enumerations

enum  MqWaitOnEventE { MQ_WAIT_NO = 0, MQ_WAIT_ONCE = 1, MQ_WAIT_FOREVER = 2 }
 wait for an event? More...

Functions

MQ_EXTERN enum MqErrorE MqProcessEvent (struct MqS *const context, MQ_TIME_T timeout, enum MqWaitOnEventE const wait)
 Waiting for an incoming packet on all open msgque objects.

Variables

enum MqErrorE(* EventCreateF )(struct MqS *const )
 prototype for a Event-Check function


Detailed Description

handle different aspects of the MqS event-queue

the event-queue have to be linked into an existing event-processing infrastructure. the linking is done by defining prototypes for two independent functions:


Typedef Documentation

typedef void( * MqEventF)(struct MqS *const )

prototype for a Event-Checking function

Definition at line 439 of file msgque.h.


Enumeration Type Documentation

wait for an event?

Enumerator:
MQ_WAIT_NO  just do the check
MQ_WAIT_ONCE  wait for one new event
MQ_WAIT_FOREVER  wait forever

Definition at line 300 of file msgque.h.


Function Documentation

MQ_EXTERN enum MqErrorE MqProcessEvent ( struct MqS *const   context,
MQ_TIME_T  timeout,
enum MqWaitOnEventE const   wait 
)

Waiting for an incoming packet on all open msgque objects.

This function is used to wait for (e.g. MQ_WAIT_ONCE) or check (e.g. MQ_WAIT_NO) for an incoming event. If an event occurs the header of the Msgque packet is parsed and the according service-handle is called. if MQ_WAIT_FOREVER is set the function will never return, accept for an error or on exit. This function is usually used on a server to enter the event-loop and wait for incoming service requests.

Parameters:
[in] context the initial MqS object created by MqContextCreate
timeout time_t type value for timeout in seconds. A value of -1 is used as default using MQ_TIMEOUT seconds.
wait should the code wait forever (e.g. MQ_WAIT_FOREVER), just wait for the next event (e.g. MQ_WAIT_ONCE) or just return after one single test (MQ_WAIT_NO)"
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE
Attention:
The timeout argument is only used if MQ_WAIT_ONCE is set.
A typical server looks like:
...
MqErrorCheck(MqLinkCreate(ctx,argv,alfa);
...
MqErrorCheck(MqProcessEvent(ctx, MQ_TIMEOUT, MQ_WAIT_FOREVER);
...
MqLinkDelete(ctx);
...

Definition at line 1062 of file msgque.c.

References MqLinkS::io, MqS::link, MQ_CONTINUE, MQ_ERROR, MQ_EXIT, MQ_OK, MQ_SELECT_RECV, MQ_TIMEOUT, MQ_TIMEOUT_USER, mq_timeval, MQ_WAIT_FOREVER, MQ_WAIT_ONCE, MqDLogC, MqDLogCL, MqDLogVL, MqErrorCheck, MqErrorStack, MqLogErrorCode(), MqSendEND(), MqSendSTART(), MqSetDebugLevel, pIoGetTimeout(), pIoSelectStart(), pWaitOnEvent(), and sMqEventStart().

Referenced by MqSendEND_AND_WAIT(), pWaitForToken(), sSysServerThreadCreate(), and SysServerFork().

Here is the caller graph for this function:


Variable Documentation

enum MqErrorE( * EventCreateF)(struct MqS *const )

prototype for a Event-Check function

This function is called by the libmsgque_private event-loop as idle-task in MqProcessEvent


libmsgque project on SF: Get libmsgque at SourceForge.net. Fast, secure and Free Open Source software downloads    Generated on Mon Nov 9 16:57:14 2009 by doxygen 1.5.8