[virt-tools-list] [virt-viewer][PATCH 1/6] events: Register event using GOnce to avoid multiple initializations
Christophe Fergeau
cfergeau at redhat.com
Fri Jul 17 16:15:39 UTC 2015
ACK
On Fri, Jul 17, 2015 at 04:01:18PM +0200, Fabiano Fidêncio wrote:
> Based on
> http://libvirt.org/git/?p=libvirt-glib.git;a=commit;h=8f8d9ce5238dbcbce40aa04ba55b8c55f97c79c0
>
> Related to: rhbz#1243228
> ---
> src/virt-viewer-events.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/virt-viewer-events.c b/src/virt-viewer-events.c
> index 3b5a136..6154353 100644
> --- a/src/virt-viewer-events.c
> +++ b/src/virt-viewer-events.c
> @@ -346,14 +346,22 @@ virt_viewer_events_remove_timeout(int timer)
> return 0;
> }
>
> -
> -void virt_viewer_events_register(void) {
> +static gpointer event_register_once(gpointer data G_GNUC_UNUSED)
> +{
> virEventRegisterImpl(virt_viewer_events_add_handle,
> virt_viewer_events_update_handle,
> virt_viewer_events_remove_handle,
> virt_viewer_events_add_timeout,
> virt_viewer_events_update_timeout,
> virt_viewer_events_remove_timeout);
> +
> + return NULL;
> +}
> +
> +void virt_viewer_events_register(void) {
> + static GOnce once = G_ONCE_INIT;
> +
> + g_once(&once, event_register_once, NULL);
> }
>
> /*
> --
> 2.4.4
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20150717/a023b4bf/attachment.sig>
More information about the virt-tools-list
mailing list