A wrapped environment.
More...
#include <wrapped_env.hpp>
A wrapped environment.
- Since
- v.5.5.9
- Note
- Starts a SObjectizer Environment in the constructor. Automatically stops it in the destructor (via stop_then_join() call). An Environment will be started on the context of new thread. This thread is also created in the constructor of wrapped_env_t.
-
SObjectizer Environment is started with autoshutdown disabled. It means that the Environment won't be stopped when the last coop will be deregistered. Autoshutdown will be disabled even if a constructor with custom Environment's params will be used.
- Usage examples
int main()
{
...
...
} );
...
return 0;
}
int main()
{
...
}
};
...
return 0;
}
{
...
return params;
}
int main()
{
...
},
make_params()
};
...
return 0;
}
int main()
{
...
},
...
}
};
...
return 0;
}
int main()
{
...
...
...
}
- Attention
- Please note that if an init function is passed to the constructor of wrapped_env_t objects then it is possible that this init function will work longer than lifetime of wrapped_env_t object. For example:
int some_func() {
};
...
return 42;
}
This can lead to some nasty surprises. For example: [](so_5::environment & env) {
env.introduce_coop(...);
env.introduce_coop(...);
...
env.introduce_coop(...);
}
};
...
- Examples:
- so_5/convert_lib/main.cpp, so_5/intercom_statechart/main.cpp, so_5/mchain_handler_formats/main.cpp, so_5/mchain_multi_consumers/main.cpp, so_5/mchain_select/main.cpp, so_5/mchain_svc_req/main.cpp, so_5/state_deep_history/main.cpp, so_5/wrapped_env_demo/main.cpp, so_5/wrapped_env_demo_2/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.
◆ wrapped_env_t() [1/7]
◆ wrapped_env_t() [2/7]
◆ wrapped_env_t() [3/7]
so_5::wrapped_env_t::wrapped_env_t |
( |
| ) |
|
Default constructor.
Starts environment without any initialization actions.
◆ wrapped_env_t() [4/7]
A constructor which receives only initialization function.
Default environment parameters will be used.
- Parameters
-
init_func | Initialization function. |
◆ wrapped_env_t() [5/7]
A constructor which receives initialization function and a function for environment's params tuning.
- Parameters
-
init_func | Initialization function. |
params_tuner | Function for environment's params tuning. |
◆ wrapped_env_t() [6/7]
A constructor which receives initialization function and already prepared environment's params.
- Parameters
-
init_func | Initialization function. |
params | Environment's params. |
◆ wrapped_env_t() [7/7]
A constructor which receives already prepared environment's params.
- Since
- v.5.5.13
- Parameters
-
params | Environment's params. |
◆ ~wrapped_env_t()
so_5::wrapped_env_t::~wrapped_env_t |
( |
| ) |
|
Destructor.
Stops the environment and waits it.
◆ environment()
◆ join()
void so_5::wrapped_env_t::join |
( |
| ) |
|
Wait for complete finish of environment's work.
◆ stop()
void so_5::wrapped_env_t::stop |
( |
| ) |
|
Send stop signal to environment.
◆ stop_then_join()
void so_5::wrapped_env_t::stop_then_join |
( |
| ) |
|
Send stop signal and wait for complete finish of environment's work.
◆ m_impl
std::unique_ptr< details_t > so_5::wrapped_env_t::m_impl |
|
private |
The documentation for this class was generated from the following files: