History | View | Annotate | Download (11.8 kB)
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 ofselect() is overridden. This is wrong as we may skip a socket event, asshown in this example:...
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move include files to include/block/
aio: Get rid of qemu_aio_flush()
There are no remaining users, and new users should probably beusing bdrv_drain_all() in the first place.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vl: delay thread initialization after daemonization
Commit ac4119c (chardev: Use timer instead of bottom-half to postponeopen event, 2012-10-12) moved the alarm timer initialization to an earlierpoint but failed to consider that it depends on qemu_init_main_loop....
vl: unify calls to init_timer_alarm
init_timer_alarm was being called twice. This is not needed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
main-loop: use aio_notify for qemu_notify_event
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
aio: introduce AioContext, move bottom halves there
Start introducing AioContext, which will let us remove globals fromaio.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...
aio: add I/O handlers to the AioContext interface
With this patch, I/O handlers (including event notifier handlers) can beattached to a single AioContext.
aio: add non-blocking variant of aio_wait
This will be used when polling the GSource attached to an AioContext.
aio: add Win32 implementation
The Win32 implementation will only accept EventNotifiers, thus a fewdrivers are disabled under Windows. EventNotifiers are a good matchfor the GSource implementation, too, because the Win32 port of gliballows to place their HANDLEs in a GPollFD....
main-loop: use GSource to poll AIO file descriptors
This lets us remove the hooks for the main loop in async.c.
main-loop: unify qemu_init_main_loop between QEMU and tools
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 <sw@weilnetz.de>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
main-loop: Fix build for w32 and w64
This patch fixes a build regression with MinGW which was introduced bycommit 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....
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 maximumvalue;
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>...
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 <sw@weilnetz.de>
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
main-loop: integrate glib sources for w32
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
main-loop: replace WaitForMultipleObjects with g_poll
On w32, glib implements g_poll using WaitForMultipleObjectsor MsgWaitForMultipleObjects. This means that we can simplifyour code by switching to g_poll, and at the same time prepare foradding back glib sources....
main-loop: interrupt wait when data arrives on a socket
Right now, the main loop is not interrupted when data arrives on asocket. To fix this, register each socket to interrupt the main loopwith WSAEventSelect. This does not replace select, it only communicates...
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 thetimeout, glib_select_fill and os_host_main_loop_wait.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
main-loop: disable fd_set-based glib integration under w32
Using select with glib pollfds is wrong under w32. Restrictthe code to the POSIX case.
main-loop: make qemu_event_handle static
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
main-loop: Fix SetEvent() on uninitialized handle on win32
The attribute((constructor)) init_main_loop() automatically getcalled if qemu-tool.o is linked in. On win32, this leads toa qemu_notify_event() call which attempts to SetEvent() on a HANDLE that...
main-loop: For tools, initialize timers as part of qemu_init_main_loop()
In some cases initializing the alarm timers can lead to non-negligableoverhead from programs that link against qemu-tool.o. At least,setting a max-resolution WinMM alarm timer via mm_start_timer() (the...
cleanup, save a syscall
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
main-loop: Add missing include file
stdint.h defines the POSIX data types and is neededfor MinGW-w64 (and maybe other hosts).
v2: Instead of adding stdint.h directly, qemu-common.h is nowincluded and duplicate include statements were removed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>...
main-loop: create main-loop.c