Blame docs/libvirt-glib/html/Libvirt-glib-Event-loop.html

Packit a07778
Packit a07778
<html>
Packit a07778
<head>
Packit a07778
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit a07778
<title>Event loop: Libvirt GLib Reference Manual</title>
Packit a07778
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit a07778
<link rel="home" href="index.html" title="Libvirt GLib Reference Manual">
Packit a07778
<link rel="up" href="ch01.html" title="API Reference">
Packit a07778
<link rel="prev" href="Libvirt-glib-Error-reporting.html" title="Error reporting">
Packit a07778
<link rel="next" href="object-tree.html" title="Object Hierarchy">
Packit a07778
<meta name="generator" content="GTK-Doc V1.29 (XML mode)">
Packit a07778
<link rel="stylesheet" href="style.css" type="text/css">
Packit a07778
</head>
Packit a07778
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit a07778
Packit a07778
Packit a07778
Top  | 
Packit a07778
                  Description
Packit a07778
Packit a07778
Home
Packit a07778
Up
Packit a07778
Prev
Packit a07778
Next
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778

Event loop

Packit a07778

Event loop — Integrate libvirt with the GMain event framework

Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778

Stability Level

Packit a07778
Packit a07778
develop applications to these interfaces, release them, and have confidence that
Packit a07778
they will run on all minor releases of the product (after the one in which the
Packit a07778
interface was introduced, and within the same major release). Even at a major
Packit a07778
release, incompatible changes are expected to be rare, and to have strong
Packit a07778
justifications.
Packit a07778
">Stable, unless otherwise indicated
Packit a07778
Packit a07778
Packit a07778

Functions

Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778
void
Packit a07778
Packit a07778
Packit a07778
gvir_event_register ()
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778
Packit a07778

Includes

Packit a07778
#include <libvirt-glib/libvirt-glib.h>
Packit a07778
Packit a07778
Packit a07778
Packit a07778

Description

Packit a07778

The libvirt API has the ability to provide applications with asynchronous

Packit a07778
notifications of interesting events. To enable this functionality though,
Packit a07778
applications must provide libvirt with an event loop implementation. The
Packit a07778
libvirt-glib API provides such an implementation, which naturally integrates
Packit a07778
with the GMain event loop framework.

Packit a07778

To enable use of the GMain event loop glue, the gvir_event_register()

Packit a07778
should be invoked. Once this is done, it is mandatory to have the default
Packit a07778
GMain event loop run by a thread in the application, usually the primary
Packit a07778
thread, eg by using gtk_main() or g_application_run()

Packit a07778
Packit a07778

Example 3. Registering for events with a GTK application

Packit a07778
Packit a07778
  
Packit a07778
    
Packit a07778
      
Packit a07778
        
1
Packit a07778
2
Packit a07778
3
Packit a07778
4
Packit a07778
5
Packit a07778
6
Packit a07778
7
Packit a07778
        
int main(int argc, char **argv) {
Packit a07778
  ...setup...
Packit a07778
  gvir_event_register();
Packit a07778
  ...more setup...
Packit a07778
  gtk_main();
Packit a07778
  return 0;
Packit a07778
}
Packit a07778
      
Packit a07778
    
Packit a07778
  
Packit a07778
Packit a07778
Packit a07778
Packit a07778

Packit a07778

Example 4. Registering for events using Appplication

Packit a07778
Packit a07778
  
Packit a07778
    
Packit a07778
      
Packit a07778
        
1
Packit a07778
2
Packit a07778
3
Packit a07778
4
Packit a07778
5
Packit a07778
6
Packit a07778
7
Packit a07778
8
Packit a07778
        
int main(int argc, char **argv) {
Packit a07778
  ...setup...
Packit a07778
  GApplication *app = ...create some impl of GApplication...
Packit a07778
  gvir_event_register();
Packit a07778
  ...more setup...
Packit a07778
  g_application_run(app);
Packit a07778
  return 0;
Packit a07778
}
Packit a07778
      
Packit a07778
    
Packit a07778
  
Packit a07778
Packit a07778
Packit a07778
Packit a07778

Packit a07778
Packit a07778
Packit a07778

Functions

Packit a07778
Packit a07778

gvir_event_register ()

Packit a07778
void
Packit a07778
gvir_event_register (void);
Packit a07778

Registers a libvirt event loop implementation that is backed

Packit a07778
by the default GMain context. If invoked more
Packit a07778
than once this method will be a no-op. Applications should,
Packit a07778
however, take care not to register any another non-GLib
Packit a07778
event loop with libvirt.

Packit a07778

After invoking this method, it is mandatory to run the

Packit a07778
default GMain event loop. Typically this can be satisfied
Packit a07778
by invoking gtk_main or g_application_run
Packit a07778
in the application's main thread. Failure to run the event
Packit a07778
loop will mean no libvirt events get dispatched, and the
Packit a07778
libvirt keepalive timer will kill off libvirt connections
Packit a07778
frequently.

Packit a07778
Packit a07778
Packit a07778
Packit a07778

Types and Values

Packit a07778
Packit a07778
Packit a07778
Packit a07778

Generated by GTK-Doc V1.29
Packit a07778
</body>
Packit a07778
</html>