mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Change the naming scheme for class field members
I'm not a fan of Hungarian notation, but C++ kind of needs it with its implicit `this`. And of all the common options for this, I find suffixing members with an underscore the least offensive one.
This commit is contained in:
@@ -67,26 +67,26 @@ class StdIoCapture {
|
||||
* The pipe endpoint where all output from the original file descriptor gets
|
||||
* redirected to. This can be read from like any other `Boost.Asio` stream.
|
||||
*/
|
||||
boost::asio::posix::stream_descriptor pipe;
|
||||
boost::asio::posix::stream_descriptor pipe_;
|
||||
|
||||
private:
|
||||
/**
|
||||
* The file descriptor of the stream we're capturing.
|
||||
*/
|
||||
const int target_fd;
|
||||
const int target_fd_;
|
||||
|
||||
/**
|
||||
* A copy of the original file descriptor. Will be used to undo
|
||||
* the capture when this object gets destroyed.
|
||||
*/
|
||||
const int original_fd_copy;
|
||||
const int original_fd_copy_;
|
||||
|
||||
/**
|
||||
* The two file descriptors generated by the `pipe()` function call.
|
||||
* `pipe_fd[1]` is used to reopen/capture the passed file descriptor, and
|
||||
* `pipe_fd[0]` can be used to read the captured output from.
|
||||
*/
|
||||
int pipe_fd[2];
|
||||
int pipe_fd_[2];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -148,12 +148,12 @@ class GroupBridge {
|
||||
* thread.
|
||||
*
|
||||
* Once the plugin has exited, this thread will then be joined to the main
|
||||
* thread and removed from the `active_plugins` from the main IO context. If
|
||||
* this causes the vector to become empty, we will terminate this process.
|
||||
* This check is delayed by a few seconds to prevent having to constantly
|
||||
* restart the group process during plugin scanning.
|
||||
* thread and removed from the `active_plugins_` from the main IO context.
|
||||
* If this causes the vector to become empty, we will terminate this
|
||||
* process. This check is delayed by a few seconds to prevent having to
|
||||
* constantly restart the group process during plugin scanning.
|
||||
*
|
||||
* @param plugin_id The ID of this plugin in the `active_plugins` map. Used
|
||||
* @param plugin_id The ID of this plugin in the `active_plugins_` map. Used
|
||||
* to unload the plugin and join this thread again after the plugin exits.
|
||||
*
|
||||
* @note In the case that the process starts but no plugin gets initiated,
|
||||
@@ -181,7 +181,7 @@ class GroupBridge {
|
||||
* handling and message loop interaction also has to be done from that
|
||||
* thread, which is why we initialize the plugin here and use the
|
||||
* `handle_dispatch()` function to run events within the same
|
||||
* `main_context`.
|
||||
* `main_context_`.
|
||||
*
|
||||
* @see handle_plugin_run
|
||||
*/
|
||||
@@ -205,14 +205,14 @@ class GroupBridge {
|
||||
* identify which plugin is generating (debug) output, every line will only
|
||||
* be prefixed with the name of the group.
|
||||
*/
|
||||
Logger logger;
|
||||
Logger logger_;
|
||||
|
||||
/**
|
||||
* The IO context that connections will be accepted on, and that any plugin
|
||||
* operations that may involve the Win32 mesasge loop (e.g. initialization
|
||||
* and most `AEffect::dispatcher()` calls) should be run on.
|
||||
*/
|
||||
MainContext main_context;
|
||||
MainContext main_context_;
|
||||
/**
|
||||
* A seperate IO context that handles the STDIO redirect through
|
||||
* `StdIoCapture`. This is separated from the `main_context` above so that
|
||||
@@ -220,33 +220,33 @@ class GroupBridge {
|
||||
* related operation should be run from the same thread, we can't just add
|
||||
* another thread to the main IO context.
|
||||
*/
|
||||
boost::asio::io_context stdio_context;
|
||||
boost::asio::io_context stdio_context_;
|
||||
|
||||
boost::asio::streambuf stdout_buffer;
|
||||
boost::asio::streambuf stderr_buffer;
|
||||
boost::asio::streambuf stdout_buffer_;
|
||||
boost::asio::streambuf stderr_buffer_;
|
||||
/**
|
||||
* Contains a pipe used for capturing this process's STDOUT stream. Needed
|
||||
* to be able to process the output generated by Wine and plugins and to be
|
||||
* able write it write it to an external log file.
|
||||
*/
|
||||
StdIoCapture stdout_redirect;
|
||||
StdIoCapture stdout_redirect_;
|
||||
/**
|
||||
* Contains a pipe used for capturing this process's STDERR stream. Needed
|
||||
* to be able to process the output generated by Wine and plugins and to be
|
||||
* able write it write it to an external log file.
|
||||
*/
|
||||
StdIoCapture stderr_redirect;
|
||||
StdIoCapture stderr_redirect_;
|
||||
/**
|
||||
* A thread that runs the `stdio_context` loop.
|
||||
* A thread that runs the `stdio_context_` loop.
|
||||
*/
|
||||
Win32Thread stdio_handler;
|
||||
Win32Thread stdio_handler_;
|
||||
|
||||
boost::asio::local::stream_protocol::endpoint group_socket_endpoint;
|
||||
boost::asio::local::stream_protocol::endpoint group_socket_endpoint_;
|
||||
/**
|
||||
* The UNIX domain socket acceptor that will be used to listen for incoming
|
||||
* connections to spawn new plugins within this process.
|
||||
*/
|
||||
boost::asio::local::stream_protocol::acceptor group_socket_acceptor;
|
||||
boost::asio::local::stream_protocol::acceptor group_socket_acceptor_;
|
||||
|
||||
/**
|
||||
* A map of threads that are currently hosting a plugin within this process
|
||||
@@ -255,24 +255,24 @@ class GroupBridge {
|
||||
* this map. This is to keep track of the amount of plugins currently
|
||||
* running with their associated thread handles. The key that identifies the
|
||||
* thread and plugin is a unique plugin ID obtained by doing a fetch-and-add
|
||||
* on `next_plugin_id`.
|
||||
* on `next_plugin_id_`.
|
||||
*/
|
||||
std::unordered_map<size_t,
|
||||
std::pair<Win32Thread, std::unique_ptr<HostBridge>>>
|
||||
active_plugins;
|
||||
active_plugins_;
|
||||
/**
|
||||
* A counter for the next unique plugin ID. When hosting a new plugin we'll
|
||||
* do a fetch-and-add to ensure that every thread gets its own unique
|
||||
* identifier.
|
||||
*/
|
||||
std::atomic_size_t next_plugin_id;
|
||||
std::atomic_size_t next_plugin_id_;
|
||||
/**
|
||||
* A mutex to prevent two threads from simultaneously accessing the plugins
|
||||
* map, and also to prevent `handle_plugin_run()` from terminating the
|
||||
* process because it thinks there are no active plugins left just as a new
|
||||
* plugin is being spawned.
|
||||
*/
|
||||
std::mutex active_plugins_mutex;
|
||||
std::mutex active_plugins_mutex_;
|
||||
|
||||
/**
|
||||
* A timer to defer shutting down the process, allowing for fast plugin
|
||||
@@ -281,10 +281,10 @@ class GroupBridge {
|
||||
*
|
||||
* @see handle_plugin_run
|
||||
*/
|
||||
boost::asio::steady_timer shutdown_timer;
|
||||
boost::asio::steady_timer shutdown_timer_;
|
||||
/**
|
||||
* A mutex to prevent two threads from simultaneously modifying the shutdown
|
||||
* timer when multiple plugins exit at the same time.
|
||||
*/
|
||||
std::mutex shutdown_timer_mutex;
|
||||
std::mutex shutdown_timer_mutex_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user