Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, you should keep in mind that Windows provides a number of mechanisms to deal with threading for you: <a href="http://msdn.microsoft.com/en-us/library/aa363862%28VS.85%29.aspx" rel="nofollow noreferrer">I/O Completion Ports</a>, <a href="http://msdn.microsoft.com/en-us/library/ms686756%28v=VS.85%29.aspx" rel="nofollow noreferrer">old thread pools</a> and <a href="http://msdn.microsoft.com/en-us/library/ms686766%28v=VS.85%29.aspx" rel="nofollow noreferrer">new thread pools</a>. Depending on what you're doing any of them might be useful for your purposes.</p> <p>As to "sending" data from one thread to another, you have a couple of choices. Windows message queues are thread-safe, and a a thread (even if it doesn't have a window) can have a message queue, which you can post messages to using <code>PostThreadMessage</code>.</p> <p>I've also posted code for a thread-safe queue in <a href="https://stackoverflow.com/questions/3054701/is-there-a-set-of-win32-api-functions-to-manage-synchronized-queues/3054795#3054795">another answer</a>.</p> <p>As far as having the thread continue executing, but take note when a change has happened, the typical method is to have it call <code>WaitForSingleObject</code> with a timeout value of 0, then check the return value -- if it's <code>WAIT_OBJECT_0</code>, the Event (or whatever) has been set, so it needs to take note of the change. If it's <code>WAIT_TIMEOUT</code>, there's been no change, and it can continue executing. Either way, <code>WaitForSingleObject</code> returns immediately.</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.
    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