c# - Sending an exception from thread to main thread? -
I want to pass an exception to the current thread (this thread is not the main thread) on the main thread. Why? Because I check my hard lock in any other thread (check that thread to check), and when hardlock
is not accessible or invalid, then I can make an exception which is by itself Defines it and then it throws an exception. Br> So this exception does not work properly; <<< P>
Your best bet is to replace thread
with > task
(. New in .NET 4.0) Tasks
class handles the appropriate Marshal of the exception to examine the outcome of the work.
If you want to use it then Net 4.0 is not possible, so one of CoreEx.dll has an exception. Preferences Forrotho
extension method that keeps the call stack safe for exceptions. You can use it to martial the exception of another code with the help of malio SynchronizationContext
.
Comments
Post a Comment