do not start sendq thread if async mode is disabled

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2018-07-17 21:46:18 +02:00
parent ed551eecc1
commit 20d8ef6f0d
2 changed files with 14 additions and 4 deletions

View file

@ -1125,8 +1125,11 @@ int rtps_init (void)
}
}
nn_xpack_sendq_init();
nn_xpack_sendq_start();
if (config.xpack_send_async)
{
nn_xpack_sendq_init();
nn_xpack_sendq_start();
}
#ifdef DDSI_INCLUDE_NETWORK_CHANNELS
/* Create a delivery queue and start tev for each channel */
@ -1413,8 +1416,11 @@ void rtps_term (void)
xeventq_free (gv.xevents);
nn_xpack_sendq_stop();
nn_xpack_sendq_fini();
if (config.xpack_send_async)
{
nn_xpack_sendq_stop();
nn_xpack_sendq_fini();
}
#ifdef DDSI_INCLUDE_NETWORK_CHANNELS
chptr = config.channels;

View file

@ -1236,6 +1236,10 @@ struct nn_xpack * nn_xpack_new (ddsi_tran_conn_t conn, uint32_t bw_limit, bool a
const nn_vendorid_t myvendorid = MY_VENDOR_ID;
struct nn_xpack *xp;
/* Disallow setting async_mode if not configured to enable async mode: this way we
can avoid starting the async send thread altogether */
assert (!async_mode || config.xpack_send_async);
xp = os_malloc (sizeof (*xp));
memset (xp, 0, sizeof (*xp));
xp->async_mode = async_mode;