[zeromq-dev] zmq_poll stops expiring timeout in virtualized Windows 7

Ivan Pechorin ivan.pechorin at gmail.com
Thu Nov 7 06:42:02 CET 2013


Felipe,

> We can make our own GetTickCount64 built around GetTickCount and call it
when GetTickCount64 is not available in Kernel32.dll. This code supports
Windows 2000 or greater, whereas calling GetTickCount64 directly from
Kernel32.dll supports only Vista or greater.
>
> static DWORD s_wrap = 0;
> static DWORD s_lastTick = 0;
> static std::mutex s_wrapMutex;
>
> ULONGLONG MyGetTickCount64()
> {
>     std::unique_lock<std::mutex>_(wrapMutex);
>     DWORD currentTick = ::GetTickCount();
>     if (currentTick < s_lastTick)
>         ++s_wrap;
>
>     s_lastTick = currentTick;
>     return (static_cast<ULONGLONG>(s_wrap) << 32) + currentTick;
> }

This particular implementation breaks build on both Visual Studio 2008 and
2010 as there is no c++11 std::mutex in these compilers.

Regards,
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131107/5ef61eac/attachment.html>


More information about the zeromq-dev mailing list