Re: [gnet] Question about gnet echoserver-gserver example



On Tue, 2006-03-28 at 13:07 -0800, yinglcs2 yahoo com wrote:

> I have a question below in the gnet
> echoserver-gserver example:
>   signal (SIGINT, ob_sig_int);
> 
>   /* Start the main loop */
>   g_main_run(main_loop);
> 
> why we signal 'SIGINT' before the main loop?
> and the implementation of ob_sig_int is the *DELETE*
> the ob_server? Why we do that? why delete teh
> ob_server before the main loop?

signal() does not _emit_ a signal, it sets up a handler for a specific
signal, in this case SIGINT, so that the ob_sig_int function is called
when you press control-C on the command line to stop the echoserver. It
then cleans up in that function and returns a FAILURE error code to the
system. (This is just guess work mostly, I don't know why it was added
originally)

Cheers
 -Tim






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]