multithreading - How to pass exception from one thread to another (caller's) thread in Delphi? -


I have another question! Please see this example:

  // There is a class with some method: type TMyClass = class public process Proc1; End; // Some thread class is: TMyThread = class (TThread) executed secure process; Override; End; Process TMyClass.Proc1; Started // This method is just calling another thread: Freonitiriting with TMyThread.Create (True): = True; Biodata; End; // + some more actions; TMyThread.Execute Process; In this example // start this thread just throws an exception: raise exceptions. Create ('some exceptions'); End;  

All I want to do is get the raised exception in TMyClass.Proc1 and throw it like this:

  var myObject: TMyClass; Start myObject: = TMyClass.Create; Try MyObject.Proc1; // Launch and see what events are except E: Exception WriteErrorLog (E.Message); End; FreeAndNil (myObject); End;  

Please tell me how can I do something like this? thanks a lot!

Oh! One more thing - IM coding on Delphi 5, that is why I have nothing about 'Tithread's' "FatalException" property or '.'

You can use it:

AcquireExceptionObject returns a point on the current exception object and prevents the exception object from exiting the current exception handler.

Then you can send the pointer to the second thread and if you lift it, it will be free for you, otherwise you will have to call it for free.


Comments