How to sleep forever only using C++11
<p>Yes, I could use Sleep() in Windows or pause() in POSIX, and goes on.
But how do I sleep only using C++11? I thought there was a way, which is joining calling thread using std::this_thread but std::this_thread has no join() method unlike pthread functions.
Not to mention that we can't handle signals with C++11 and I know how to iterate sleep forever like below:</p>

<pre><code>while(true)
   std::this_thread::sleep_for(std::chrono::seconds(1));
</code></pre>

<p>However, as you can see, It's not elegant at all. This code still consumes CPU time. The scheduler has to care for this process. I could also use conditional variable or promise, but then again it takes up a bit of memory or wouldn't work on certain OS(it would throw an exception to avoid deadlock).</p>

<p>Maybe this could be the equivalent of Sleep(INFINITE) of Windows:</p>

<pre><code>while(true)
   std::this_thread::sleep_for(std::chrono::hours::max());
</code></pre>

<p>But many say it's not practical.</p>

<p>Could anyone think of brilliant way?</p>