make internal thread liveliness monitoring optional
Internal thread liveliness monitoring means having a thread that wakes up periodically, doing nothing but checking whether all seems well. In most case, this is not worth the resources and energy. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
519a1ffb92
commit
a72a581cb0
4 changed files with 29 additions and 17 deletions
|
@ -105,9 +105,11 @@ dds_init(void)
|
|||
|
||||
ut_avlInit(&dds_domaintree_def, &dds_global.m_domains);
|
||||
|
||||
/* Start monitoring the liveliness of all threads and renewing the
|
||||
service lease if everything seems well. */
|
||||
|
||||
/* Start monitoring the liveliness of all threads. */
|
||||
if (!config.liveliness_monitoring)
|
||||
gv.servicelease = NULL;
|
||||
else
|
||||
{
|
||||
gv.servicelease = nn_servicelease_new(0, 0);
|
||||
if (gv.servicelease == NULL)
|
||||
{
|
||||
|
@ -119,6 +121,7 @@ dds_init(void)
|
|||
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Failed to start the servicelease.");
|
||||
goto fail_servicelease_start;
|
||||
}
|
||||
}
|
||||
|
||||
if (rtps_init() < 0)
|
||||
{
|
||||
|
@ -159,6 +162,7 @@ skip:
|
|||
|
||||
fail_rtps_init:
|
||||
fail_servicelease_start:
|
||||
if (gv.servicelease)
|
||||
nn_servicelease_free (gv.servicelease);
|
||||
gv.servicelease = NULL;
|
||||
fail_servicelease_new:
|
||||
|
@ -195,6 +199,7 @@ extern void dds_fini (void)
|
|||
dds__builtin_fini();
|
||||
|
||||
rtps_term ();
|
||||
if (gv.servicelease)
|
||||
nn_servicelease_free (gv.servicelease);
|
||||
gv.servicelease = NULL;
|
||||
downgrade_main_thread ();
|
||||
|
|
|
@ -256,6 +256,7 @@ struct config
|
|||
int squash_participants;
|
||||
int startup_mode_full;
|
||||
int forward_all_messages;
|
||||
int liveliness_monitoring;
|
||||
int noprogress_log_stacktraces;
|
||||
int prioritize_retransmit;
|
||||
int xpack_send_async;
|
||||
|
|
|
@ -491,6 +491,12 @@ static const struct cfgelem heartbeat_interval_attrs[] = {
|
|||
END_MARKER
|
||||
};
|
||||
|
||||
static const struct cfgelem liveliness_monitoring_attrs[] = {
|
||||
{ LEAF("StackTraces"), 1, "true", ABSOFF(noprogress_log_stacktraces), 0, uf_boolean, 0, pf_boolean,
|
||||
"<p>This element controls whether or not to write stack traces to the DDSI2 trace when a thread fails to make progress (on select platforms only).</p>" },
|
||||
END_MARKER
|
||||
};
|
||||
|
||||
static const struct cfgelem unsupp_cfgelems[] = {
|
||||
{ MOVED("MaxMessageSize", "General/MaxMessageSize") },
|
||||
{ MOVED("FragmentSize", "General/FragmentSize") },
|
||||
|
@ -585,8 +591,8 @@ static const struct cfgelem unsupp_cfgelems[] = {
|
|||
"<p>This setting controls the maximum (CDR) serialised size of samples that DDSI2E will forward in either direction. Samples larger than this are discarded with a warning.</p>" },
|
||||
{ LEAF("WriteBatch"), 1, "false", ABSOFF(whc_batch), 0, uf_boolean, 0, pf_boolean,
|
||||
"<p>This element enables the batching of write operations. By default each write operation writes through the write cache and out onto the transport. Enabling write batching causes multiple small write operations to be aggregated within the write cache into a single larger write. This gives greater throughput at the expense of latency. Currently there is no mechanism for the write cache to automatically flush itself, so that if write batching is enabled, the application may havee to use the dds_write_flush function to ensure thta all samples are written.</p>" },
|
||||
{ LEAF("LogStackTraces"), 1, "true", ABSOFF(noprogress_log_stacktraces), 0, uf_boolean, 0, pf_boolean,
|
||||
"<p>This element controls whether or not to write stack traces to the DDSI2 trace when a thread fails to make progress (on select platforms only).</p>" },
|
||||
{ LEAF_W_ATTRS("LivelinessMonitoring", liveliness_monitoring_attrs), 1, "false", ABSOFF(liveliness_monitoring), 0, uf_boolean, 0, pf_boolean,
|
||||
"<p>This element controls whether or not implementation should internally monitor its own liveliness. If liveliness monitoring is enabled, stack traces can be dumped automatically when some thread appears to have stopped making progress.</p>" },
|
||||
{ LEAF("MonitorPort"), 1, "-1", ABSOFF(monitor_port), 0, uf_int, 0, pf_int,
|
||||
"<p>This element allows configuring a service that dumps a text description of part the internal state to TCP clients. By default (-1), this is disabled; specifying 0 means a kernel-allocated port is used; a positive number is used as the TCP port number.</p>" },
|
||||
{ LEAF("AssumeMulticastCapable"), 1, "", ABSOFF(assumeMulticastCapable), 0, uf_string, ff_free, pf_string,
|
||||
|
|
|
@ -295,7 +295,7 @@ static void reap_thread_state (_Inout_ struct thread_state1 *ts1, _In_ int sync_
|
|||
{
|
||||
os_mutexLock (&thread_states.lock);
|
||||
ts1->state = THREAD_STATE_ZERO;
|
||||
if (sync_with_servicelease)
|
||||
if (sync_with_servicelease && gv.servicelease)
|
||||
nn_servicelease_statechange_barrier (gv.servicelease);
|
||||
if (ts1->name != main_thread_name)
|
||||
os_free (ts1->name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue