WPILibC++ 2024.3.2
wpi::sig Namespace Reference

Namespaces

namespace  detail
 
namespace  trait
 

Classes

class  Connection
 A Connection object allows interaction with an ongoing slot connection. More...
 
class  ConnectionBlocker
 ConnectionBlocker is a RAII object that blocks a connection until destruction. More...
 
class  ScopedConnection
 ScopedConnection is a RAII version of Connection It disconnects the slot from the signal upon destruction. More...
 
class  SignalBase
 SignalBase is an implementation of the observer pattern, through the use of an emitting object and slots that are connected to the signal and called with supplied arguments when a signal is emitted. More...
 

Typedefs

template<typename... T>
using Signal = SignalBase< detail::NullMutex, T... >
 Specialization of SignalBase to be used in single threaded contexts. More...
 
template<typename... T>
using Signal_mt = SignalBase< mutex, T... >
 Specialization of SignalBase to be used in multi-threaded contexts. More...
 
template<typename... T>
using Signal_r = SignalBase< recursive_mutex, T... >
 Specialization of SignalBase to be used in multi-threaded contexts, allowing for recursive signal emission and emission cycles. More...
 

Typedef Documentation

◆ Signal

template<typename... T>
using wpi::sig::Signal = typedef SignalBase<detail::NullMutex, T...>

Specialization of SignalBase to be used in single threaded contexts.

Slot connection, disconnection and signal emission are not thread-safe. This is significantly smaller than the thread-safe variant.

◆ Signal_mt

template<typename... T>
using wpi::sig::Signal_mt = typedef SignalBase<mutex, T...>

Specialization of SignalBase to be used in multi-threaded contexts.

Slot connection, disconnection and signal emission are thread-safe.

Beware of accidentally using recursive signal emission or cycles between two or more signals in your code. Locking std::mutex more than once is undefined behavior, even if it "seems to work somehow". Use signal_r instead for that use case.

◆ Signal_r

template<typename... T>
using wpi::sig::Signal_r = typedef SignalBase<recursive_mutex, T...>

Specialization of SignalBase to be used in multi-threaded contexts, allowing for recursive signal emission and emission cycles.

Slot connection, disconnection and signal emission are thread-safe.