title: Change std::thread execution flow with signals in c++
body: <p>I have a program starting an std::thread doing the following: sleep X, execute a function, terminate.</p>
  
  <pre><code>create std::thread(Xms, &amp;func)
    wait Xms
    then do func()
    end
  </code></pre>
  
  <p>I was wondering if I could for example send a signal to my std::thread in order to instantly break the sleep and do func, then quit.</p>
  
  <p>Do I need to send the signal to std::thread::id in order to perform this?</p>
  
  <p>my thread is launched this way, with a lambda function:</p>
  
  <pre><code>template&lt;typename T, typename U&gt;
  void                          execAfter(T func, U params, const int ms)
  {
    std::thread                 thread([=](){
        std::this_thread::sleep_for(std::chrono::milliseconds(ms));
        func(params);
      });
    thread.detach();
  }
  </code></pre>