halyavin added inline comments.

================
Comment at: include/__threading_support:474
+      
system_clock::time_point(duration_cast<system_clock::duration>(duration));
+  auto timeout_ms = duration_cast<milliseconds>(abstime - system_clock::now());
+
----------------
compnerd wrote:
> halyavin wrote:
> > Since negative timeouts can't be avoided, we must make sure that 
> > timeout_ms.count() is at least zero.
> Good point.  I suppose that the assert takes care of that though.
Negative timeout_ms.count() is a normal case, we shouldn't fail on assertion. 
The reason is that program can always be slow enough for current timestamp 
(system_clock::now()) to pass any fixed point in time (__ts/abstime). 


================
Comment at: include/__threading_support:476
+
+  _LIBCPP_ASSERT(timeout_ms.count() > INFINITE && "timeout duration overflow");
+  if (!SleepConditionVariableSRW(__cv, __m, timeout_ms.count(), 0))
----------------
compnerd wrote:
> halyavin wrote:
> > It is >= INFINITE. _LIBCPP_ASSERT has 2 arguments and supports error 
> > message out of the box.
> Shouldnt this be, `timeout_ms.count() > 0` which implicitly ensures that it 
> is not `INFINITE` (-1)?
I just checked in the Windows SDK, INFINITE is defined as `0xFFFFFFFF` and 
negative timeouts are legal anyway.



Repository:
  rL LLVM

https://reviews.llvm.org/D28220



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to