Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to keep message-pumping while waiting?
    primarykey
    data
    text
    <p>I have an application that is based on a message-pump thread-pool archtecture. Whenever there is an action that could block, it is implemented as "callback on complete/trigger evnet" action, so it won't stall the executing thread.</p> <p>While this techniqiue is appropriate for most cases, there are situations when it becomes very inconvinient and over-complicates the code.</p> <p>What I'd like to be able to do is, to keep processing events while waiting, in a transparent way, without breaking the function up into pre/post waiting parts.</p> <p>How should I do this?</p> <p>I had two options in mind:</p> <ol> <li>Run the message loop from within the executing function while waiting.</li> <li>Create a new working thread while waiting, and terminating it (in a proper way) when resuming.</li> </ol> <p>Both options have their flaws, to name a few:</p> <p>For 1:</p> <ul> <li>Could potentially result in stack overflow.</li> <li>Could potentially end up dead-locked.</li> <li>If the inner message results in waiting for a second event to complete, and the outer event completes in the meanwhile, the outer function can't continue until the second event completes, and this situation can expand.</li> </ul> <p>Option 2 can simply end up in creating more and more threads.</p> <p>Ofcourse, there might be other options that I haven't thought of.</p> <p><strong>EDIT:</strong> Language is C++, so functions can't be stepped out of and into in an easy (portable?) manner. Platform is Windows (API), although I don't think it's relevant.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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