SObjectizer
5.7
|
From the very beginning of SObjectizer-4 and SObjectizer-5 dispatchers could be added only before the start of SObjectizer Run-Time. There was no a possibility to add new dispatcher when SObjectizer Run-Time is running.
The situation is slightly changed in v.5.4.0 where add_dispatcher_if_not_exist()
method was added to so_5::rt::environment_t class. It added the possibility to introduce new dispatcher instance when it necessary. But there was not a way to remove a dispatcher which is no more used by anyone.
This problem has been solved in v.5.5.4 by introducing a new conception – private dispatcher.
Private dispatcher is an instance of dispatcher that has no name and accessible only by a special handle for it. While there is a handle, there is the dispatcher. When all handles are destroyed the dispatcher is destroyed too.
Private dispatcher handle is in fact a smart intrusive pointer. So the concept of private dispatcher handles should be natural to the C++ programmers because it is a form of resources management via ordinary smart pointers.
Since v.5.5.4 every dispatcher type defines the following things:
private_dispatcher_t
with one or several binder()
methods for creating binders to the private dispatcher of that type;private_dispatcher_handle_t
which can be seen as a smart pointer for private_dispatcher_t
(and in fact is);create_private_disp()
for creating an instance of the private dispatcher.So there are so_5::disp::one_thread::private_dispatcher_t, so_5::disp::one_thread::private_dispatcher_handle_t, so_5::disp::one_thread::create_private_disp(). There also are so_5::disp::active_obj::private_dispatcher_t, so_5::disp::active_obj::private_dispatcher_handle_t, so_5::disp::active_obj::create_private_disp() and so on.
There is an example of usage of private dispatcher of various types: