2
3
6
7
8
9
10
14#include <so_5/environment_infrastructure.hpp>
15#include <so_5/mchain.hpp>
17#include <so_5/disp/one_thread/pub.hpp>
18#include <so_5/disp/nef_one_thread/pub.hpp>
20#include <so_5/impl/coop_repository_basis.hpp>
21#include <so_5/impl/final_dereg_chain_helpers.hpp>
23#include <so_5/stats/impl/std_controller.hpp>
25#include <so_5/timers.hpp>
41
42
43
44
45
54 coop_listener_unique_ptr_t coop_listener );
62
63
64
65
80
81
82
86 coop_shptr_t coop )
noexcept;
101
102
103
104
116
117
118
120
121
122
123
124
128
129
130
131
132
133
134
135
139
140
141
142
146
147
148
149
150
151
152
153
154
155
156
160
161
162
163
164
165
168
169
172
173
174
175
180
181
182
183
184
185
186
187
191 std::unique_lock< std::mutex > & lck )
noexcept;
198
199
200
201
208
209
210
211
212
223 environment_params_t::default_disp_params_t default_disp_params,
225 timer_thread_unique_ptr_t timer_thread,
227 coop_listener_unique_ptr_t coop_listener,
229 mbox_t stats_distribution_mbox );
232 launch( env_init_t init_fn )
override;
235 stop()
noexcept override;
241 disp_binder_shptr_t default_binder )
override;
249 coop_shptr_t coop )
noexcept override;
253 coop_shptr_t coop_name )
noexcept override;
257 const std::type_index & type_wrapper,
258 const message_ref_t & msg,
260 std::chrono::steady_clock::duration pause,
261 std::chrono::steady_clock::duration period )
override;
265 const std::type_index & type_wrapper,
266 const message_ref_t & msg,
268 std::chrono::steady_clock::duration pause )
override;
291
292
293
294
295
296
297
298
299
300
301
302
307
308
309
310
311
312
313
Type of smart handle for a cooperation.
A special type that plays role of unique_ptr for coop.
void start_deregistration()
Initiate start of the cooperation deregistration.
void ready_to_deregister_notify(coop_shptr_t coop)
Notification about readiness of the cooperation deregistration.
std::condition_variable m_final_dereg_chain_cond
Notification object to inform that the chain of coops for the final deregistration isn't empty anymor...
bool final_deregister_coop(coop_shptr_t coop) noexcept
Do final actions of the cooperation deregistration.
void process_current_final_dereg_chain(std::unique_lock< std::mutex > &lck) noexcept
Method that performs the final deregistration for coops in the m_final_dereg_chain.
so_5::impl::final_dereg_chain_holder_t m_final_dereg_chain
The chain of coops for the final deregistration.
std::mutex m_final_dereg_chain_lock
Lock object for thread-safety of the chain of coops ready for the final deregistration.
coop_repo_t(outliving_reference_t< environment_t > env, coop_listener_unique_ptr_t coop_listener)
Initializing constructor.
void wait_all_coop_to_deregister()
Wait for end of all cooperations deregistration.
void start()
Do initialization.
void final_dereg_thread_body()
Method that implements the body of final deregistration thread.
std::condition_variable m_deregistration_started_cond
Condition variable for the deregistration start indication.
bool m_final_dereg_thread_shutdown_flag
The flag for shutting down the final deregistration thread.
std::condition_variable m_deregistration_finished_cond
Condition variable for the deregistration finish indication.
environment_infrastructure_t::coop_repository_stats_t query_stats()
Get the current statistic for run-time monitoring.
std::thread m_final_dereg_thread
A separate thread for doing the final deregistration.
void finish()
Finish work.
void wait_for_start_deregistration()
Wait for a signal about start of the cooperation deregistration.
Default implementation of multithreaded environment infrastructure.
so_5::timer_id_t schedule_timer(const std::type_index &type_wrapper, const message_ref_t &msg, const mbox_t &mbox, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period) override
Initiate a timer (delayed or periodic message).
::so_5::stats::repository_t & stats_repository() noexcept override
Get stats repository for the environment.
coop_repo_t m_coop_repo
Repository of registered cooperations.
const environment_params_t::default_disp_params_t m_default_dispatcher_params
Parameters for the default dispatcher.
timer_thread_stats_t query_timer_thread_stats() override
Query run-time statistics for timer (thread or manager).
void single_timer(const std::type_index &type_wrapper, const message_ref_t &msg, const mbox_t &mbox, std::chrono::steady_clock::duration pause) override
Initiate a delayed message.
void stop() noexcept override
Initiate a signal for shutdown of Environment.
coop_handle_t register_coop(coop_unique_holder_t coop) override
Register new cooperation.
::so_5::stats::controller_t & stats_controller() noexcept override
Get stats controller for the environment.
void ready_to_deregister_notify(coop_shptr_t coop) noexcept override
void run_user_supplied_init_and_wait_for_stop(env_init_t init_fn)
timer_thread_unique_ptr_t m_timer_thread
Timer thread to be used by the environment.
bool final_deregister_coop(coop_shptr_t coop_name) noexcept override
Do final actions of the cooperation deregistration.
void launch(env_init_t init_fn) override
Do actual launch of SObjectizer's Environment.
default_dispatcher_holder_t m_default_dispatcher
Default dispatcher.
void run_agent_core_and_go_further(env_init_t init_fn)
mt_env_infrastructure_t(environment_t &env, environment_params_t::default_disp_params_t default_disp_params, timer_thread_unique_ptr_t timer_thread, coop_listener_unique_ptr_t coop_listener, mbox_t stats_distribution_mbox)
Initializing constructor.
coop_unique_holder_t make_coop(coop_handle_t parent, disp_binder_shptr_t default_binder) override
Create an instance of a new coop.
coop_repository_stats_t query_coop_repository_stats() override
Query run-time statistics for cooperation repository.
void run_timer_thread_and_go_further(env_init_t init_fn)
::so_5::stats::impl::std_controller_t m_stats_controller
Run-time stats controller to be used by the environment.
environment_t & m_env
SOEnv for that this infrastructure was created.
void run_default_dispatcher_and_go_further(env_init_t init_fn)
disp_binder_shptr_t make_default_disp_binder() override
Create a binder for the default dispatcher.
An interface for environment_infrastructure entity.
A basic part for various implementations of coop_repository.
void deregister_all_coop() noexcept
Deregisted all cooperations.
environment_infrastructure_t::coop_repository_stats_t query_stats()
Get the current statistic for run-time monitoring.
try_switch_to_shutdown_result_t try_switch_to_shutdown() noexcept
Try to switch repository to shutdown state.
Helper class for holding the current chain of coops for the final deregistration.
Helper class for indication of long-lived reference via its type.
A public interface for control SObjectizer monitoring options.
An interface of data sources repository.
An indentificator for the timer.
Default multi-threaded environment infrastructure.
SO_5_FUNC environment_infrastructure_factory_t factory()
A factory for creation the default multitheading environment infrastructure.
Various implementations of environment_infrastructure.
Details of SObjectizer run-time implementations.
Internal implementation of run-time monitoring and statistics related stuff.
All stuff related to run-time monitoring and statistics.
Private part of message limit implementation.
Statistical data for run-time monitoring of coop repository content.
Statistics for run-time monitoring.