Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>However after the dispose doesn't continue like I thought it would. </p> </blockquote> <p>You mean the call to Dispose hangs/blocks? That is because you did not close the client socket before you return from the thread. (My syntax below may be wrong but you get the idea)</p> <pre><code> if (e.Errno == ETERM) { //Catch a termination error. Debug.WriteLine("Terminated! 1"); client.Close(); return; } </code></pre> <p>Setting linger to 0 is not enough - that just prevents the socket closure from blocking. You must still close the socket in your worker thread to prevent the _context.Dispose() from blocking.</p> <blockquote> <p>This is how the ZGuide says to handle destruction of the context and sockets...</p> </blockquote> <p>Well - that's true but there is an important qualifier in the document:</p> <blockquote> <p>We'll get to multithreading in the next chapter, but because some of you will, despite warnings, will try to run before you can safely walk, below is the quick and dirty guide to making a clean exit in a multithreaded ØMQ application.</p> </blockquote> <p>Later in the document they describe how to do a clean shutdown by having a dedicated socket in each thread which listens to a kill signal. Consider enhancing your worker thread by doing something similar. This way you can request each thread to shut itself down by sending each thread a message - each thread then exits its run loop, does a clean close on it's socket(s) and exits. Once all threads have exited you can safely dispose of the context without having any errors.</p>
    singulars
    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. 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