Projects
domecam:swift
domecam
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 34
View file
domecam.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Dec 22 12:34:03 UTC 2023 - Matwey V. Kornilov <matwey@sai.msu.ru> + +- Version 0.1.20 + +------------------------------------------------------------------- Wed Dec 20 12:09:43 UTC 2023 - Matwey V. Kornilov <matwey@sai.msu.ru> - Version 0.1.19
View file
_service
Changed
@@ -3,7 +3,7 @@ <param name="url">http://curl.sai.msu.ru/hg/home/matwey/domecam/</param> <param name="scm">hg</param> <param name="versionformat">{latesttag}</param> - <param name="revision">0.1.19</param> + <param name="revision">0.1.20</param> </service> <service name="tar" mode="buildtime" /> <service name="recompress" mode="buildtime">
View file
domecam-0.1.19.obscpio/.hgtags -> domecam-0.1.20.obscpio/.hgtags
Changed
@@ -17,3 +17,4 @@ ee7ef40e4a1d664c5e36cc223e5dec42a81f2a95 0.1.16 d1a0b26dcf61c5fb7db5c6e97ec89f6b62b91e00 0.1.17 68a22903a6fbcb758f8a004b30e13df2c9cfb5f4 0.1.18 +5e3bffd0832be5f703e75f4080f2b9b96feddda4 0.1.19
View file
domecam-0.1.19.obscpio/CMakeLists.txt -> domecam-0.1.20.obscpio/CMakeLists.txt
Changed
@@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.5) -project(domecam LANGUAGES C CXX VERSION 0.1.19) +project(domecam LANGUAGES C CXX VERSION 0.1.20) option(BUILD_DOMECAMD "build domecamd" ON) option(BUILD_DOMECAM_PROC "build domecam-proc" ON)
View file
domecam-0.1.19.obscpio/exe/domecam-replayd/main.cpp -> domecam-0.1.20.obscpio/exe/domecam-replayd/main.cpp
Changed
@@ -15,6 +15,8 @@ #include <application.h> #include <io.h> +#include <thread_group.h> + #include <exe/domecam-replayd/consumer.h> @@ -70,7 +72,15 @@ auto ctx = load_json<domecam_replayd_context>(boost::filesystem::path{vaconfig_opt.as<std::string>()}); consumer cmr{io_context_, ctx.amqp_uri_}; - io_context_.run(); + /* We need at least two threads: one for work, and one for AMQP + * heartbreaks, signal handling, etc. */ + constexpr std::size_t concurrency = 2; + + thread_group tg(concurrency, this (std::size_t) { + io_context_.run(); + }); + + tg.join(); return 0; }
View file
domecam-0.1.19.obscpio/exe/domecamd/main.cpp -> domecam-0.1.20.obscpio/exe/domecamd/main.cpp
Changed
@@ -15,6 +15,8 @@ #include <application.h> #include <io.h> +#include <thread_group.h> + #include <exe/domecamd/consumer.h> @@ -72,7 +74,15 @@ auto ctx = load_json<domecamd_context>(boost::filesystem::path{vaconfig_opt.as<std::string>()}); consumer cmr{io_context_, ctx.camera_, ctx.amqp_uri_}; - io_context_.run(); + /* We need at least two threads: one for work, and one for AMQP + * heartbreaks, signal handling, etc. */ + constexpr std::size_t concurrency = 2; + + thread_group tg(concurrency, this (std::size_t) { + io_context_.run(); + }); + + tg.join(); return 0; }
View file
domecam-0.1.20.obscpio/include/thread_group.h
Added
@@ -0,0 +1,46 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2023 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#ifndef _THREAD_GROUP_H +#define _THREAD_GROUP_H + +#include <cassert> +#include <thread> +#include <utility> +#include <vector> + + +class thread_group { +public: + using value_type = std::thread; + + template<class Function, class... Args> + explicit thread_group(std::size_t size, Function&& f, Args&&... args) { + assert(size > 0); + + threads_.reserve(size); + + for (std::size_t worker_id = 0; worker_id < size; ++worker_id) + threads_.emplace_back(std::forward<Function>(f), worker_id, std::forward<Args>(args)...); + } + + bool joinable() const noexcept; + void join(); + + std::size_t size() const noexcept { return threads_.size(); } + + void swap(thread_group& other) noexcept; + +private: + std::vector<value_type> threads_; +}; + + +namespace std { + void swap(thread_group& lhs, thread_group& rhs) noexcept; +} // std + +#endif // _THREAD_GROUP_H
View file
domecam-0.1.20.obscpio/src/thread_group.cpp
Added
@@ -0,0 +1,30 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2023 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#include <algorithm> + +#include <thread_group.h> + + +bool thread_group::joinable() const noexcept { + return std::all_of(threads_.cbegin(), threads_.cend(), (const value_type& thread) -> bool { + return thread.joinable(); + }); +} + +void thread_group::join() { + std::for_each(threads_.begin(), threads_.end(), (value_type& thread) { + thread.join(); + }); +} + +void thread_group::swap(thread_group& other) noexcept { + threads_.swap(other.threads_); +} + +void std::swap(thread_group& lhs, thread_group& rhs) noexcept { + lhs.swap(rhs); +}
View file
domecam.obsinfo
Changed
@@ -1,3 +1,3 @@ name: domecam -version: 0.1.19 -mtime: 1703074056 +version: 0.1.20 +mtime: 1703248395
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.