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

Re: [win-pv-devel] [PATCH] Prevent events getting lost, and remove xenstore polling



> -----Original Message-----
> From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
> Behalf Of Ben Chalmers
> Sent: 03 July 2017 11:58
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Ben Chalmers <ben.chalmers@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH] Prevent events getting lost, and remove
> xenstore polling
> 
> Auto-resetting events, on occaision, are getting lost.  This
> can be avoided by ensuring events are manually rest.
> 
> As events are no longer lost, there is no longer a need to
> poll shudown or suspend every minute
> 
> Also fix invocation of CreateEvent methods
> 
> Signed-Off-By: Ben.Chalmers@xxxxxxxxxx
> ---
>  src/xenagent/service.cpp | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
> index d917821..0b44186 100644
> --- a/src/xenagent/service.cpp
> +++ b/src/xenagent/service.cpp
> @@ -63,9 +63,9 @@ CXenIfaceCreator::CXenIfaceCreator(CXenAgent&
> agent) :
>      m_ctxt_shutdown(NULL), m_ctxt_suspend(NULL),
>      m_ctxt_slate_mode(NULL), m_agent(agent)
>  {
> -    m_evt_shutdown = CreateEvent(FALSE, NULL, NULL, FALSE);
> -    m_evt_suspend = CreateEvent(FALSE, NULL, NULL, FALSE);
> -    m_evt_slate_mode = CreateEvent(FALSE, NULL, NULL, FALSE);
> +    m_evt_shutdown = CreateEvent(NULL, TRUE, FALSE, NULL);
> +    m_evt_suspend = CreateEvent(NULL, TRUE, FALSE, NULL);
> +    m_evt_slate_mode = CreateEvent(NULL, TRUE, FALSE, NULL);

Yikes. Those arguments were completely backwards before!

>      m_count = 0;
> 
>      InitializeCriticalSection(&m_crit);
> @@ -711,22 +711,26 @@ bool CXenAgent::ServiceMainLoop()
>                           m_xeniface.m_evt_shutdown,
>                           m_xeniface.m_evt_suspend,
>                           m_xeniface.m_evt_slate_mode };
> -    DWORD   wait = WaitForMultipleObjectsEx(4, events, FALSE, 60000, TRUE);
> +    DWORD   wait = WaitForMultipleObjectsEx(4, events, FALSE, INFINITE,
> TRUE);
> 
>      switch (wait) {
>      case WAIT_OBJECT_0:
> +        ResetEvent(m_svc_stop);
>          return false; // exit loop
> 
>      case WAIT_OBJECT_0+1:
> +        ResetEvent(m_xeniface.m_evt_shutdown);
>          return !m_xeniface.CheckShutdown();
> 
>      case WAIT_OBJECT_0+2:
> +        ResetEvent(m_xeniface.m_evt_suspend);
>          m_xeniface.CheckSuspend();
>          return true; // continue loop
> 
>      case WAIT_OBJECT_0+3: {
>          std::string mode;
> 
> +        ResetEvent(m_xeniface.m_evt_slate_mode);
>          if (m_xeniface.CheckSlateMode(&mode))
>              m_conv.SetSlateMode(mode);
> 

LGTM.

Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> --
> 2.10.1.windows.1
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.