Note that there are some explanatory texts on larger screens.

plurals
  1. PODelegate Thread Must be allowed to complete
    primarykey
    data
    text
    <p>So I invoke a thread from managed code this way:</p> <pre><code> Action&lt;EFScmTechnologiesContext, long, long&gt; updateReference = UpdateReferenceBaseline; IAsyncResult ar = updateReference.BeginInvoke(_context, baseline.Id, updatedBaseline.Id, null, null); </code></pre> <p>I have taken care to make sure that this class's destructor waits for the thread to complete. So for most normal cases, the thread is allowed to do its work before the process exists. However, I suspect there might be conditions (unhandled exceptions on other thread perhaps?) where the destructor is not called and the thread is terminated without being allowed it to complete.</p> <p>What do I have to do . . . either in the delegate or the wrapper class, to make sure this thread is allowed to complete regardless of exceptions, aborts or exits in another thread?</p> <p>I read about UnhandledExceptionHandler(), but wasn't sure exactly what to do with it . . . I think by the time that handler is called my thread is already toast. I could also put a try/catch block in the delegate, but that would mean the thread is already interrupted from doing its current operations.</p> <p>I also recognize that depending on the exception involved, the whole application environment might be toast . . . so even if I can catch/prevent the thread's termination . . . I probably should only allow it 30 seconds or so to try and complete its work and then let it die regardless . . .</p> <p>I see lots of information on threads and exceptions in general, etc . . . but very little on the Exit process and the final moments of a process's life . . . if anyone has a pointer to a good description, please . . . </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.
 

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