rework listener invocation and entity status flags
Listener/status management invocation was rather expensive, and especially the cost of checking listeners, then setting status flags and triggering waitsets ran into severe lock contention. A major cost was the repeated use of dds_entity_lock and dds_entity_unlock, these have been eliminated. Another cost was that each time an event occurred (with DATA_AVAILABLE the most problematic one) it would walk the chain of ancestors to see if any had a relevant listener, and only if none of them had any, it would set the status flags. The locking/unlocking of the entity has been eliminated by moving the listener/status flag manipulation from the general entity lock to its m_observers_lock. That lock has a much smaller scope, and consequently contention has been significantly reduced. Instead of walking the entity hierarchy looking for listeners, an entity now inherits the ancestors' listeners. The set_listener operation has been made a little more complicated by the need to not only set the listeners for the specified entity, but to also update any inherited listeners its descendants. The commit is a bit larger than strictly needed ... I've started reformatting the code to reduce the variety of styles ... as there I haven't been able to find a single tool that does what I want, it may well end up as manual work. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
2e5ecb2e76
commit
ba46cb1140
14 changed files with 1401 additions and 1795 deletions
|
@ -44,16 +44,9 @@ typedef void (*dds_on_requested_incompatible_qos_fn) (dds_entity_t reader, const
|
|||
typedef void (*dds_on_publication_matched_fn) (dds_entity_t writer, const dds_publication_matched_status_t status, void* arg);
|
||||
typedef void (*dds_on_subscription_matched_fn) (dds_entity_t reader, const dds_subscription_matched_status_t status, void* arg);
|
||||
|
||||
#if 0
|
||||
/* TODO: Why use (*dds_on_any_fn) (); and DDS_LUNSET? Why not just set the callbacks to NULL? */
|
||||
typedef void (*dds_on_any_fn) (); /**< Empty parameter list on purpose; should be assignable without cast to all of the above. @todo check with an actual compiler; I'm a sloppy compiler */
|
||||
#define DDS_LUNSET ((dds_on_any_fn)1) /**< Callback indicating a callback isn't set */
|
||||
#else
|
||||
#define DDS_LUNSET (NULL)
|
||||
#endif
|
||||
|
||||
struct c_listener;
|
||||
typedef struct c_listener dds_listener_t;
|
||||
#define DDS_LUNSET 0
|
||||
struct dds_listener;
|
||||
typedef struct dds_listener dds_listener_t;
|
||||
|
||||
/**
|
||||
* @brief Allocate memory and initializes to default values (::DDS_LUNSET) of a listener
|
||||
|
@ -104,7 +97,6 @@ DDS_DEPRECATED_EXPORT void dds_listener_copy (_Out_ dds_listener_t * __restrict
|
|||
DDS_EXPORT void dds_merge_listener (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
|
||||
DDS_DEPRECATED_EXPORT void dds_listener_merge (_Inout_ dds_listener_t * __restrict dst, _In_ const dds_listener_t * __restrict src);
|
||||
|
||||
|
||||
/************************************************************************************************
|
||||
* Setters
|
||||
************************************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue