From 42a21d444b63e2aa9e2dcf984f9ba097b00ec20d Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 31 Jul 2018 15:58:03 -0700 Subject: [PATCH] Fixed Windows high CPU utilization bug --- src/VirtualTap.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/VirtualTap.cpp b/src/VirtualTap.cpp index 6df887c..54f0f62 100644 --- a/src/VirtualTap.cpp +++ b/src/VirtualTap.cpp @@ -47,6 +47,10 @@ typedef unsigned short u16_t; #include "InetAddress.hpp" #include "OneService.hpp" +#ifdef _MSC_VER +#include "Synchapi.h" +#endif + int VirtualTap::devno = 0; VirtualTap::VirtualTap( @@ -208,7 +212,12 @@ void VirtualTap::threadMain() throw() { while (true) { +#ifdef _MSC_VER + Sleep(ZT_PHY_POLL_INTERVAL); + _phy.poll(0); +#else _phy.poll(ZT_PHY_POLL_INTERVAL); +#endif Housekeeping(); } }