There are the following possibilities to create threads in Delphi / C++ Builder applications:
Usually your code will use TThread or BeginThread as low-level thread creation routines. Or your code may use frameworks/thread pools. You should never use CreateThread function to create threads.
EurekaLog offers two extended routines which greatly simplify creating threads for debugging:
It is recommended to use BeginThreadEx function instead of BeginThread function and to use TThreadEx class instead of TThread class.
Important note: turning off low-level hooks means that EurekaLog will not install additional hooks for API functions. This means that EurekaLog will not intercept important system calls. For example, EurekaLog will not hook ExitThread function, which means EurekaLog will not know when a thread exits. This will lead to thread information stored forever - until application terminates. You can call internal _NotifyThreadGone or _CleanupFinishedThreads functions (from EThreadsManager unit) to notify EurekaLog about thread's termination. Such manual notifications can be avoided by using EurekaLog's wrappers (TThreadEx, for example).
Note: when your thread is processing exception, the processing will be performed in a background thread. EurekaLog's event handlers will be called from a background thread. You need to use some sort of synchronization if you are accessing global data in your EurekaLog's event handlers. This also means that several threads can process multiple exceptions simultaneously at the same time. You can avoid this by marshaling processing to main thread. For example, you can use TThread(Ex) and analyze .FatalException property in your main thread. See description of TThreadEx class for examples. Alternatively, you may use "Consecutive processing" option.
See also:
|