|
Goby3 3.3.0
2025.07.10
|
Base class for building multithreaded applications for a given implementation of the InterProcessPortal. This class isn't used directly by user applications, for that use a specific implementation, e.g. zeromq::MultiThreadApplication. More...
#include <goby/middleware/application/multi_thread.h>
Public Member Functions | |
| MultiThreadApplication (double loop_freq_hertz=0) | |
| Construct the application calling loop() at the given frequency (double overload) | |
| MultiThreadApplication (boost::units::quantity< boost::units::si::frequency > loop_freq) | |
| Construct the application calling loop() at the given frequency (boost::units overload) | |
| virtual | ~MultiThreadApplication () |
Public Member Functions inherited from goby::middleware::MultiThreadApplicationBase< Config, InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > > > | |
| void | launch_thread () |
| void | launch_thread (int index) |
| void | launch_thread (const ThreadConfig &cfg) |
| void | launch_thread (int index, const ThreadConfig &cfg) |
| void | launch_thread_without_cfg () |
| void | launch_thread_without_cfg (int index) |
| void | join_thread (int index=-1) |
| void | launch_timer (boost::units::quantity< boost::units::si::frequency > freq, std::function< void()> on_expire) |
| void | join_timer () |
| int | running_thread_count () |
Public Member Functions inherited from goby::middleware::Application< Config > | |
| Application () | |
| virtual | ~Application () |
Public Member Functions inherited from goby::middleware::Thread< Config, TransporterType > | |
| Thread (const Config &cfg, TransporterType *transporter, int index) | |
| Construct a thread with a given configuration, underlying transporter, and index (for multiple instantiations), but without any loop() frequency. | |
| Thread (const Config &cfg, TransporterType *transporter, double loop_freq_hertz=0, int index=-1) | |
| Construct a thread with all possible metadata (using double to specify frequency in Hertz) | |
| Thread (const Config &cfg, TransporterType *transporter, boost::units::quantity< boost::units::si::frequency > loop_freq, int index=-1) | |
| Construct a thread with all possible metadata (using boost::units to specify frequency) | |
| virtual | ~Thread () |
| void | run (std::atomic< bool > &alive) |
| Run the thread until the boolean reference passed is set false. This call blocks, and should be run in a std::thread by the caller. | |
| int | index () const |
| std::type_index | type_index () |
| void | set_type_index (std::type_index type_i) |
| std::string | name () |
| void | set_name (const std::string &name) |
| int | uid () |
| void | set_uid (int uid) |
Protected Member Functions | |
| InterThreadTransporter & | interthread () |
| InterProcessPortal< InterThreadTransporter > & | interprocess () |
| InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > > & | intervehicle () |
| virtual void | health (goby::middleware::protobuf::ThreadHealth &health) override |
| Called when HealthRequest is made by goby_coroner. | |
| virtual void | post_initialize () override |
| Assume all required subscriptions are done in the Constructor or in initialize(). If this isn't the case, this method can be overridden. | |
Protected Member Functions inherited from goby::middleware::MultiThreadApplicationBase< Config, InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > > > | |
| MultiThreadApplicationBase (boost::units::quantity< boost::units::si::frequency > loop_freq, InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > > *transporter) | |
| virtual | ~MultiThreadApplicationBase () |
| InterThreadTransporter & | interthread () |
| virtual void | post_finalize () override |
| Called just after finalize. | |
| std::map< std::type_index, std::map< int, ThreadManagement > > & | threads () |
| void | join_all_threads () |
Protected Member Functions inherited from goby::middleware::Application< Config > | |
| virtual void | pre_initialize () |
| Called just before initialize. | |
| virtual void | initialize () |
| Perform any initialize tasks that couldn't be done in the constructor. | |
| virtual void | pre_finalize () |
| Called just before finalize. | |
| virtual void | finalize () |
| Perform any final cleanup actions just before the destructor is called. | |
| void | quit (int return_value=0) |
| Requests a clean exit. | |
| const Config & | app_cfg () |
| Accesses configuration object passed at launch. | |
| const util::UTMGeodesy & | geodesy () |
| Accesses the geodetic conversion tool if lat_origin and lon_origin were provided. | |
| bool | has_geodesy () |
| Returns if the geodesy tool is configured with a datum. | |
| std::string | app_name () |
| bool | app_alive () |
| boost::units::quantity< boost::units::si::frequency > | choose_loop_freq (boost::units::quantity< boost::units::si::frequency > compiled_loop_freq) |
| void | configure_geodesy (goby::util::UTMGeodesy::LatLonPoint datum) |
Protected Member Functions inherited from goby::middleware::Thread< Config, TransporterType > | |
| Thread (const Config &cfg, boost::units::quantity< boost::units::si::frequency > loop_freq, int index=-1) | |
| void | set_transporter (TransporterType *transporter) |
| virtual void | loop () |
| double | loop_frequency_hertz () const |
| decltype(loop_frequency_) | loop_frequency () const |
| double | loop_max_frequency () const |
| void | run_once () |
| TransporterType & | transporter () const |
| const Config & | cfg () const |
| virtual void | initialize () |
| virtual void | finalize () |
| void | thread_health (goby::middleware::protobuf::ThreadHealth &health) |
| void | thread_quit () |
| bool | alive () |
Protected Member Functions inherited from goby::middleware::coroner::ApplicationInterThread< MultiThreadApplication< Config, InterProcessPortal > > | |
| void | subscribe_coroner () |
Protected Member Functions inherited from goby::middleware::terminate::Application< MultiThreadApplication< Config, InterProcessPortal > > | |
| void | subscribe_terminate (bool do_quit=true) |
Friends | |
| class | coroner::ApplicationInterThread< MultiThreadApplication< Config, InterProcessPortal > > |
| class | terminate::Application< MultiThreadApplication< Config, InterProcessPortal > > |
| template<typename App > | |
| class | goby::middleware::julia::ApplicationWrapper |
Additional Inherited Members | |
Public Types inherited from goby::middleware::Application< Config > | |
| using | ConfigType = Config |
Public Types inherited from goby::middleware::Thread< Config, TransporterType > | |
| using | Transporter = TransporterType |
Static Public Attributes inherited from goby::middleware::Thread< Config, TransporterType > | |
| static constexpr goby::middleware::Group | shutdown_group_ {"goby::middleware::Thread::shutdown"} |
| static constexpr goby::middleware::Group | joinable_group_ {"goby::middleware::Thread::joinable"} |
Protected Types inherited from goby::middleware::MultiThreadApplicationBase< Config, InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > > > | |
| using | MainThreadBase = Thread< Config, InterVehicleForwarder< InterProcessPortal< InterThreadTransporter > > > |
Base class for building multithreaded applications for a given implementation of the InterProcessPortal. This class isn't used directly by user applications, for that use a specific implementation, e.g. zeromq::MultiThreadApplication.
| Config | Configuration type |
| InterProcessPortal | the interprocess portal type to use (e.g. zeromq::InterProcessPortal). |
Definition at line 255 of file multi_thread.h.
|
inline |
Construct the application calling loop() at the given frequency (double overload)
| loop_freq_hertz | The frequency at which to attempt to call loop(), assuming the main thread isn't blocked handling transporter callbacks (e.g. subscribe callbacks). Zero or negative indicates loop() will never be called. |
Definition at line 277 of file multi_thread.h.
|
inline |
Construct the application calling loop() at the given frequency (boost::units overload)
| loop_freq | The frequency at which to attempt to call loop(), assuming the main thread isn't blocked handling transporter callbacks (e.g. subscribe callbacks). Zero or negative indicates loop() will never be called. |
Definition at line 285 of file multi_thread.h.
|
inlinevirtual |
Definition at line 310 of file multi_thread.h.
|
inlineoverrideprotectedvirtual |
Called when HealthRequest is made by goby_coroner.
Override to implement thread specific health response
Reimplemented from goby::middleware::Thread< Config, TransporterType >.
Definition at line 320 of file multi_thread.h.
|
inlineprotected |
Definition at line 314 of file multi_thread.h.
|
inlineprotected |
Definition at line 313 of file multi_thread.h.
|
inlineprotected |
Definition at line 315 of file multi_thread.h.
|
inlineoverrideprotectedvirtual |
Assume all required subscriptions are done in the Constructor or in initialize(). If this isn't the case, this method can be overridden.
Reimplemented from goby::middleware::Application< Config >.
Definition at line 327 of file multi_thread.h.
|
friend |
Definition at line 263 of file multi_thread.h.
|
friend |
Definition at line 271 of file multi_thread.h.
|
friend |
Definition at line 263 of file multi_thread.h.