BloombergLP::bdlmt::Signaler

This class template provides a thread-safe signaler that executes connected slots when invoked via its call operator. t_PROT is a function signature and must have a return type of void. The callable objects assigned to the slots may have return types other than void, in which case their return values will be discarded.

Synopsis

Declared in <bdlmt_signaler.h>

template<class t_PROT>
class Signaler
    : public Signaler_Invocable<Signaler<t_PROT>, t_PROT>

Base Classes

NameDescription
Signaler_Invocable<Signaler<t_PROT>, t_PROT>Provides a call operator for the derived class bdlmt::Signaler, such that its call signature is identical to that of t_PROT.

Type Aliases

Name
ResultType

Member Functions

NameDescription
Signaler [constructor]Create a Signaler object having no connected slots. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. Note that the supplied allocator must remain valid until all connection objects associated with this signaler are destroyed.
~Signaler [destructor]Destroy this object. Call disconnectAllSlots(). The behavior is undefined if this function is invoked from a slot connected to this signaler.
connect Connect the specified slot, a callable object which must meet the Slot Object Requirements described in the component documentation, to this signaler. Optionally specify a group used to order slots upon invocation. Return an instance of SignalerConnection representing the created connection. This function meets the strong exception guarantee. Note that the connected slot may be called by a signal emitted from another thread before this function completes. Also note that it is unspecified whether connecting a slot while the signaler is emitting will result in the slot being called immediately. Note that t_FUNC may have a return type other than void, but in that case, when the slot is called, the return value will be discarded.
disconnectAllSlots Disconnect all slots, if any, connected to this signaler. Any signals emitted on the corresponding signaler that happen after this call to disconnect completes will not call any slots that were connected prior to this call. Throws nothing. Note that this function does not block the calling thread pending completion of ongoing signals emitted on the signaler. Also note that it is unspecified how many slots, if any, will be called by any invocation on the signaler that begins before this function completes. Also note that if a slot is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
disconnectAllSlotsAndWait Disconnect all slots, if any, connected to this signaler. Any signals emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots that were connected prior to this call. This function blocks the calling thread pending completion of all ongoing signals being emitted on the signaler. Throws nothing. The behavior is undefined if this method is called from a slot connected to the signaler. Note that it is unspecified how many slots, if any, will be called by any invocation on the signaler that begins before this function completes. Also note that if a slot is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
disconnectGroup Disconnect all slots, if any, connected to this signaler in the specified group. Any signal emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots in group that were connected prior to this call. Throws nothing. Note that this function does not block the calling thread pending completion of ongoing signals emitted on the signaler. Also note that it is unspecified how many affected slots, if any, will be signalled to by any invocation on the signaler that begins before this function completes. Also note that if a slot in group is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
disconnectGroupAndWait Disconnect all slots, if any, connected to this signaler in the specified group. Any signal emitted on the corresponding signaler that happens after this call to disconnect completes will not call any slots in group that were connected prior to this call. This function blocks the calling thread pending completion of ongoing signals being emitted on the signaler. Throws nothing. The behavior is undefined if this method is called from a slot connected to the signaler. Note that it is unspecified how many affected slots, if any, will be signaled to by any emission on the signaler that begins before this function completes. Also note that if a slot in group is connected to this signaler during a call to this function, it is unspecified whether that slot will be disconnected.
slotCount Return the number of slots connected to this signaler. Note that the value returned by slotCount() is approximate if the signaler is being simultaneously manipulated by other threads.
operator BloombergLP::bslmf::NestedTraitDeclaration<Signaler, UsesBslmaAllocator>

Friends

NameDescription
BloombergLP::bdlmt::Signaler_InvocableProvides a call operator for the derived class bdlmt::Signaler, such that its call signature is identical to that of t_PROT.