Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is in the implementation of <code>std::this_thread:sleep_until(..)</code> which calls <code>sleep_for(..)</code>, which calls <code>nanosleep()</code>.</p> <p>(See the <a href="http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-api-4.5/a01060_source.html#l00271" rel="nofollow noreferrer">gnu sources</a>, line 271.)</p> <p>See the following Stackoverflow questions:</p> <ul> <li><a href="https://stackoverflow.com/questions/1125297/nanosleep-high-cpu-usage">nanosleep high cpu usage?</a> (Linux high-cpu issue calling nanosleep.)</li> <li><a href="https://stackoverflow.com/questions/3072912/boostthis-threadsleep-vs-nanosleep">boost::this_thread::sleep() vs. nanosleep()?</a></li> </ul> <p>You don't appear to need the high resolution of <code>nanosleep()</code>. You might write your own solution with a permissive open source license, and call <code>sleep()</code> instead of <code>nanosleep().</code></p> <p>If you do need sub-second resolution, I recommend the technique of calling <code>select()</code> rather than <code>nanosleep()</code>. <code>select()</code> is designed to block very efficiently for sub-second delays, and the timeout parameter is respected accurately enough by most operating systems that it is useful for sub-second timing while yielding the CPU.</p> <p>You can even create a socket for the purpose of passing to <code>select()</code>, in the<code>error_fds</code> parameter, where the socket can be used as a cross-thread "signal" when it is passed to <code>close()</code> and becomes an "error" state socket.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload