blob: 56c38f643ee9e9c82ddb810eacb4a2f1f1791fed [file] [log] [blame]
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +01001#include "messanger_service.hpp"
2
3namespace utils
4{
5
6MessangerService::MessangerService(
7 boost::asio::execution_context& execution_context) :
8 boost::asio::execution_context::service(execution_context)
9{}
10
11MessangerService::Context& MessangerService::create()
12{
13 contexts_.emplace_back(std::make_unique<Context>());
14 return *contexts_.back();
15}
16
17void MessangerService::destroy(MessangerService::Context& context)
18{
Patrick Williamsc7935fa2023-10-20 11:19:30 -050019 contexts_.erase(std::remove_if(contexts_.begin(), contexts_.end(),
20 [&context](const auto& item) {
21 return item.get() == &context;
22 }),
23 contexts_.end());
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010024}
25
26boost::asio::execution_context::id MessangerService::id = {};
27
28} // namespace utils