Not to terminate ev_loop

Sandeep sandeep at b-one.net
Sun Jan 8 10:20:05 CET 2012


Thanks for the help. I am now much better in getting close to finding the
solution to my original problem (server thread and client threads).
Now the thing which is not clear to me is, how can I still control ev_loop
to be not terminated though all my jobs are completed, and it must wait for
further more jobs.

A simple algorithm can be as below, but how to really achieve this:


initializeServerThread()
{
	Init ev loop default.
	Set timers by ev_timer_init to some values.
	Ev_loop(loop, 0)
}

Void requestFromClientToServerArrived()
{
	Init an ev_io for the request and ev_start for the request

         //Work on the client request
}

Void sendResponseToClinetFromServer()
{
 //send response to client		
Ev_stop for the request
}


Void startTimerForTheRequest()
{
	Ev_timer_start for the request
}

Void stopTimerForTheRequest()
{
	Ev_timer_stop for the request
}

Now assume that 3 clients would have sent 1 request each, so ev_io_start and
ev_io_stop would have got called 3 times. Might be ev_timer_start and
ev_timer_stop also would have got called based on application logic.
But after the server completes 3 of those requests, it must still be waiting
for more requests, but not be terminated by ev_loop)loop, 0); How do I
control this?




More information about the libev mailing list