OnixS C++ FIX Engine  4.11.0
API Documentation
Scheduler Threading Models

The Scheduler supports the following threading models:

The model is configured via the OnixS::FIX::Scheduling::SessionSchedulerOptions::threadingModel(SchedulerThreadingModel::Enum value) method.

DedicatedThreads

This threading model is the default one. In this mode, the Scheduler creates one thread to manage registered sessions. Additionally, one thread per session is created when a session needs to perform synchronous Logon/Logout.

Note
This threading model does not support sessions that use the OnixS::FIX::ThreadingModel::ExternalThread threading model.

ExternalThread

In this mode, the Scheduler does not create any threads. Such mode means that the user creates additional threads himself (or uses the main thread) to perform event dispatching in a loop by calling the OnixS::FIX::Scheduling::SessionScheduler::dispatchEvents() routine. In this mode, the Scheduler uses asynchronous Logon/Logout. Therefore, only in this mode, the Scheduler can manage sessions that use the OnixS::FIX::ThreadingModel::ExternalThread threading model. The following example demonstrates how to use this threading model:

TCPStandard::Stack stack;
Session externalThreadSession(&stack, "SenderCompId", "TargetCompId", ProtocolVersion::FIX_42, ONIXS_FIXENGINE_NULLPTR);
SessionSchedulerOptions schedulerOptions;
schedulerOptions.threadingModel(SchedulerThreadingModel::ExternalThread);
SessionScheduler scheduler(schedulerOptions);
scheduler.add(&externalThreadSession, "AllWeekSchedule", "Initiator");
bool finished = false;
// Dispatching events..
while(!finished)
{
stack.dispatchEvents();
scheduler.dispatchEvents();
}
scheduler.remove(&externalThreadSession);
while(!stack.isQuiescent())
stack.dispatchEvents();
Note
This threading model supports sessions with any threading model. Therefore, the Scheduler with ExternalThread model can manage sessions with any threading model.

See Also