Statistics
| Branch: | Revision:

root / main-loop.c @ 992aeb8e

History | View | Annotate | Download (11.8 kB)

# Date Author Comment
5e3bc735 01/09/2013 07:03 pm Fabien Chouteau

Check return values from g_poll and select

The current implementation of os_host_main_loop_wait() on Windows,
returns 1 only when a g_poll() event occurs because the return value of
select() is overridden. This is wrong as we may skip a socket event, as
shown in this example:...

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

c57b6656 12/11/2012 12:04 pm Kevin Wolf

aio: Get rid of qemu_aio_flush()

There are no remaining users, and new users should probably be
using bdrv_drain_all() in the first place.

Signed-off-by: Kevin Wolf <>

49cf5728 11/02/2012 08:07 pm Paolo Bonzini

vl: delay thread initialization after daemonization

Commit ac4119c (chardev: Use timer instead of bottom-half to postpone
open event, 2012-10-12) moved the alarm timer initialization to an earlier
point but failed to consider that it depends on qemu_init_main_loop....

f9ab4654 11/02/2012 08:07 pm Paolo Bonzini

vl: unify calls to init_timer_alarm

init_timer_alarm was being called twice. This is not needed.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

4c8d0d27 10/30/2012 10:30 am Paolo Bonzini

main-loop: use aio_notify for qemu_notify_event

Reviewed-by: Anthony Liguori <>
Signed-off-by: Paolo Bonzini <>

f627aab1 10/30/2012 10:30 am Paolo Bonzini

aio: introduce AioContext, move bottom halves there

Start introducing AioContext, which will let us remove globals from
aio.c/async.c, and introduce multiple I/O threads.

The bottom half functions now take an additional AioContext argument.
A bottom half is created with a specific AioContext that remains the...

a915f4bc 10/30/2012 10:30 am Paolo Bonzini

aio: add I/O handlers to the AioContext interface

With this patch, I/O handlers (including event notifier handlers) can be
attached to a single AioContext.

Signed-off-by: Paolo Bonzini <>

7c0628b2 10/30/2012 10:30 am Paolo Bonzini

aio: add non-blocking variant of aio_wait

This will be used when polling the GSource attached to an AioContext.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Paolo Bonzini <>

f42b2207 10/30/2012 10:30 am Paolo Bonzini

aio: add Win32 implementation

The Win32 implementation will only accept EventNotifiers, thus a few
drivers are disabled under Windows. EventNotifiers are a good match
for the GSource implementation, too, because the Win32 port of glib
allows to place their HANDLEs in a GPollFD....

82cbbdc6 10/30/2012 10:30 am Paolo Bonzini

main-loop: use GSource to poll AIO file descriptors

This lets us remove the hooks for the main loop in async.c.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Paolo Bonzini <>

172061a0 10/30/2012 10:18 am Paolo Bonzini

main-loop: unify qemu_init_main_loop between QEMU and tools

Signed-off-by: Paolo Bonzini <>

3239ad04 05/01/2012 01:46 pm Stefan Weil

main-loop: Calculate poll timeout using timeout argument

The timeout argument was unused up to now,
but it can be used to reduce the poll_timeout when it is infinite
(negative value) or larger than timeout.

Signed-off-by: Stefan Weil <>
Reviewed-by: Paolo Bonzini <>...

42fe1c24 04/28/2012 12:25 pm Stefan Weil

main-loop: Fix build for w32 and w64

This patch fixes a build regression with MinGW which was introduced by
commit 7c7db75576bd5a31508208f153c5aada64b2c8df.

The 3rd argument of g_main_context_query must point to a gint value.
Using a pointer to an uint32_t value is wrong....

7c7db755 04/26/2012 09:14 pm Stefano Stabellini

main_loop_wait: block indefinitely

- remove qemu_calculate_timeout;

- explicitly size timeout to uint32_t;

- introduce slirp_update_timeout;

- pass NULL as timeout argument to select in case timeout is the maximum
value;

Signed-off-by: Stefano Stabellini <>...

58b9630d 04/15/2012 10:25 pm Stefan Weil

w64: Fix type cast in os_host_main_loop_wait

Casting a pointer to an integer must use (DWORD_PTR) instead of (DWORD).
This also matches the definition of 'fd' (gint for w32, gint64 for w64).

Signed-off-by: Stefan Weil <>

72fe3aae 04/10/2012 04:10 pm Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches' into staging

  • stefanha/trivial-patches:
    make: fix clean rule by removing build file in qom/
    configure: Link qga against UST tracing related libraries
    configure: Link QEMU against 'liburcu-bp'...
ea26ce76 04/07/2012 11:34 am Paolo Bonzini

main-loop: integrate glib sources for w32

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

06ac7d49 04/07/2012 11:34 am Paolo Bonzini

main-loop: replace WaitForMultipleObjects with g_poll

On w32, glib implements g_poll using WaitForMultipleObjects
or MsgWaitForMultipleObjects. This means that we can simplify
our code by switching to g_poll, and at the same time prepare for
adding back glib sources....

d3385eb4 04/07/2012 11:34 am Paolo Bonzini

main-loop: interrupt wait when data arrives on a socket

Right now, the main loop is not interrupted when data arrives on a
socket. To fix this, register each socket to interrupt the main loop
with WSAEventSelect. This does not replace select, it only communicates...

4dae83ae 04/07/2012 11:34 am Paolo Bonzini

main loop: use msec-based timeout in glib_select_fill

The timeval-based timeout is not needed until we actually invoke select,
so compute it only then. Also group the two calls that modify the
timeout, glib_select_fill and os_host_main_loop_wait.

Signed-off-by: Paolo Bonzini <>...

15455536 04/07/2012 11:34 am Paolo Bonzini

main-loop: disable fd_set-based glib integration under w32

Using select with glib pollfds is wrong under w32. Restrict
the code to the POSIX case.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Blue Swirl <>

a92433af 04/03/2012 11:34 am Frediano Ziglio

main-loop: make qemu_event_handle static

Signed-off-by: Frediano Ziglio <>
Signed-off-by: Stefan Hajnoczi <>

ee77dfb2 02/01/2012 10:45 pm Michael Roth

main-loop: Fix SetEvent() on uninitialized handle on win32

The attribute((constructor)) init_main_loop() automatically get
called if qemu-tool.o is linked in. On win32, this leads to
a qemu_notify_event() call which attempts to SetEvent() on a HANDLE that...

d34e8f6e 02/01/2012 10:45 pm Michael Roth

main-loop: For tools, initialize timers as part of qemu_init_main_loop()

In some cases initializing the alarm timers can lead to non-negligable
overhead from programs that link against qemu-tool.o. At least,
setting a max-resolution WinMM alarm timer via mm_start_timer() (the...

4aa7534d 01/12/2012 06:34 pm Lai Jiangshan

cleanup, save a syscall

Signed-off-by: Lai Jiangshan <>
Signed-off-by: Anthony Liguori <>

0ec024f6 10/25/2011 11:38 pm Stefan Weil

main-loop: Add missing include file

stdint.h defines the POSIX data types and is needed
for MinGW-w64 (and maybe other hosts).

v2: Instead of adding stdint.h directly, qemu-common.h is now
included and duplicate include statements were removed.

Signed-off-by: Stefan Weil <>...

d3b12f5d 10/21/2011 07:14 pm Paolo Bonzini

main-loop: create main-loop.c

Signed-off-by: Paolo Bonzini <>