Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::events::ConnectedChildProcess Class Reference

A child process with a bidirectional IPC channel. More...

#include <child_process_manager.hpp>

Public Member Functions

 ConnectedChildProcess ()=default
 ~ConnectedChildProcess ()
bool launch (std::string_view executable, const std::vector< std::string > &extra_args={})
 Launch a child process with an IPC pipe.
bool is_running () const
 Whether the child process is running.
int pid () const
 Get the child's PID.
bool send_message (std::string_view message)
 Send a message to the child.
void kill ()
 Kill the child process.
int wait_for_exit (int timeout_ms=0)
 Wait for the child to exit. Returns exit code.
InterprocessConnection & connection ()
 The IPC connection (for advanced use).
 ConnectedChildProcess (const ConnectedChildProcess &)=delete
ConnectedChildProcess & operator= (const ConnectedChildProcess &)=delete

Public Attributes

std::function< void(std::string_view)> on_message
 Called when a message is received from the child.
std::function< void(int exit_code)> on_exit
 Called when the child process exits.

Detailed Description

A child process with a bidirectional IPC channel.

The child process connects back to the parent via a named pipe.

Constructor & Destructor Documentation

◆ ConnectedChildProcess() [1/2]

pulp::events::ConnectedChildProcess::ConnectedChildProcess ( )
default

◆ ~ConnectedChildProcess()

pulp::events::ConnectedChildProcess::~ConnectedChildProcess ( )

◆ ConnectedChildProcess() [2/2]

pulp::events::ConnectedChildProcess::ConnectedChildProcess ( const ConnectedChildProcess & )
delete

Member Function Documentation

◆ connection()

InterprocessConnection & pulp::events::ConnectedChildProcess::connection ( )
inline

The IPC connection (for advanced use).

◆ is_running()

bool pulp::events::ConnectedChildProcess::is_running ( ) const
inline

Whether the child process is running.

◆ kill()

void pulp::events::ConnectedChildProcess::kill ( )

Kill the child process.

◆ launch()

bool pulp::events::ConnectedChildProcess::launch ( std::string_view executable,
const std::vector< std::string > & extra_args = {} )

Launch a child process with an IPC pipe.

The pipe name is passed to the child as a command-line argument.

◆ operator=()

ConnectedChildProcess & pulp::events::ConnectedChildProcess::operator= ( const ConnectedChildProcess & )
delete

◆ pid()

int pulp::events::ConnectedChildProcess::pid ( ) const
inline

Get the child's PID.

◆ send_message()

bool pulp::events::ConnectedChildProcess::send_message ( std::string_view message)

Send a message to the child.

◆ wait_for_exit()

int pulp::events::ConnectedChildProcess::wait_for_exit ( int timeout_ms = 0)

Wait for the child to exit. Returns exit code.

Member Data Documentation

◆ on_exit

std::function<void(int exit_code)> pulp::events::ConnectedChildProcess::on_exit

Called when the child process exits.

◆ on_message

std::function<void(std::string_view)> pulp::events::ConnectedChildProcess::on_message

Called when a message is received from the child.

The ConnectedChildProcess object must outlive this callback; destroying the object from inside the callback is unsupported.


The documentation for this class was generated from the following file: