Root > Advanced topics > Multi-threaded applications > Enabling EurekaLog for background threads

Enabling EurekaLog for background threads

Previous pageReturn to chapter overviewNext page   

EurekaLog has two states which controls if EurekaLog should be active or not: a global state and a local (per-thread) state.


1. A global state is controlled by "Activate EurekaLog" option and it could be changed in run-time with SetEurekaLogState routine. Disabling global state will disable EurekaLog in entire application.
2. A local state is a per-thread state - i.e. each thread has its own local state which is independent from states of other threads. The local state for background threads is controlled by "Default EurekaLog state in new threads" option (the main thread is always activated by default) and it could be changed in run-time with SetEurekaLogStateInThread routine. Disabling local state will disable EurekaLog in the current thread, but will keep it activated in other threads.


EurekaLog will be active in a particular thread only if both conditions are true:

1. Global state is enabled (IsEurekaLogActive is True).
2. Local state is enabled (IsEurekaLogActiveInThread is True).

If global state is enabled, but local per-thread state is disabled - then EurekaLog will be disabled (in this thread). If local state is enabled, but global state is disabled - then EurekaLog will be disabled (again, in this thread only).


No additional actions required for single-threaded applications (apart from enabling EurekaLog for your application): because a single-threaded application contains only main thread, and EurekaLog is always enabled for main thread by default.


Multi-threaded applications is more complex, as multi-threaded application contains additional threads. EurekaLog should be enabled in a particular thread in order to work. Main thread is always enabled - regardless of EurekaLog's options. However, any background thread is disabled by default. You have to enable EurekaLog for your background threads. This can be done in two ways:

1. Automatic, via options (not recommended);
2. Manual, via code:
a. Using BeginThreadEx/TThreadEx (recommended)



See also:


Send feedback... Build date: 2018-11-26
Last edited: 2018-06-14
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: