diff --git a/block-raw-posix.c b/block-raw-posix.c index 97dd30af613b326407d6a2a245b6fc3034e39b7d..147730dd734636419484362da2b6439ba0d5acba 100644 --- a/block-raw-posix.c +++ b/block-raw-posix.c @@ -525,6 +525,7 @@ static int posix_aio_init(void) { sigset_t mask; PosixAioState *s; + struct aioinit ai; if (posix_aio_state) return 0; @@ -545,18 +546,19 @@ static int posix_aio_init(void) qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); -#if defined(__linux__) && defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 4) - { - /* XXX: aio thread exit seems to hang on RedHat 9 and this init - seems to fix the problem. */ - struct aioinit ai; - memset(&ai, 0, sizeof(ai)); - ai.aio_threads = 1; - ai.aio_num = 1; - ai.aio_idle_time = 365 * 100000; - aio_init(&ai); + memset(&ai, 0, sizeof(ai)); +#if !defined(__linux__) || (defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4)) + ai.aio_threads = 5; + ai.aio_num = 1; +#else + /* XXX: aio thread exit seems to hang on RedHat 9 and this init + seems to fix the problem. */ + ai.aio_threads = 1; + ai.aio_num = 1; + ai.aio_idle_time = 365 * 100000; } #endif + aio_init(&ai); posix_aio_state = s; return 0; diff --git a/configure b/configure index dd82e881ceb0ce0a72bf3ba44f4f269b27b03f6e..6a727c0a5aa52e680ec65052a1f215fea7737d92 100755 --- a/configure +++ b/configure @@ -482,8 +482,10 @@ if test "$mingw32" = "yes" ; then linux_user="no" fi -if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then +if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then AIOLIBS= +elif [ "$bsd" = "yes" ]; then + AIOLIBS="-lpthread" else # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. AIOLIBS="-lrt -lpthread"