qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] QEMU question: is eventfd not thread safe?


From: Benjamin Herrenschmidt
Subject: Re: [Qemu-devel] QEMU question: is eventfd not thread safe?
Date: Mon, 02 Jul 2012 09:07:51 +1000

> >> diff --git a/iohandler.c b/iohandler.c
> >> index 3c74de6..54f4c48 100644
> >> --- a/iohandler.c
> >> +++ b/iohandler.c
> >> @@ -77,6 +77,7 @@ int qemu_set_fd_handler2(int fd,
> >>          ioh->fd_write = fd_write;
> >>          ioh->opaque = opaque;
> >>          ioh->deleted = 0;
> >> +        kill(getpid(), SIGUSR2);
> >>      }
> >>      return 0;
> >>  }

That probably wants to be a pthread_kill targetted at the main loop.

> >> +static void sigusr2_print(int signal)
> >> +{
> >> +}
> >> +
> >> +static void sigusr2_init(void)
> >> +{
> >> +    struct sigaction action;
> >> +
> >> +    memset(&action, 0, sizeof(action));
> >> +    sigfillset(&action.sa_mask);
> >> +    action.sa_handler = sigusr2_print;
> >> +    action.sa_flags = 0;
> >> +    sigaction(SIGUSR2, &action, NULL);
> >> +}
> >> +

Won't that conflict with the business in coroutine-sigaltstack.c ?

Hrm... looking at it, it looks like it will save/restore the handler,
so that should be good.
 
Still, one might want to wrap that into something, like
qemu_wake_main_loop();

Cheers,
Ben.

> >>  int main_loop_init(void)
> >>  {
> >>      int ret;
> >>  
> >> +    sigusr2_init();
> >> +
> >>      qemu_mutex_lock_iothread();
> >>      ret = qemu_signal_init();
> >>      if (ret) {
> >> -- 
> >> 1.7.10
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]