Re: Unix signals in GLib
- From: Stef Walter <stef-list memberwebs com>
- To: Matthew Bucknall <matt mattbucknall com>
- Cc: Andy Wingo <wingo pobox com>, Gtk+ Developers <gtk-devel-list gnome org>, Xavier Bestel <xavier bestel free fr>
- Subject: Re: Unix signals in GLib
- Date: Fri, 30 Apr 2010 16:19:56 -0500
On 2010-04-30 13:38, Matthew Bucknall wrote:
> Find attached an excerpt from an application of mine. Not entirely
> self-contained, but you should get a general idea of what is going on.
>
> Using the attached code, my application calls app_signal_block_unused()
> early on during initialization. The signal listening thread is
> initialized and started by app_signal_init(). The thread is stopped (in
> case it has not already stopped) by calling app_signal_cleanup() as the
> application finalizes.
>
> You'll notice in read_handler() I call a function called
> app_context_stop(). Replace this function with whatever you need to stop
> your application's main loop.
If you're using a normal glib GMainLoop, one can do this in a simpler
manner without the pipe, since calling g_main_loop_quit() directly from
the sigwait thread is safe.
Cheers,
Stef
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]