remove superfluous lock from dds writer

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2018-08-01 08:38:49 +02:00
parent 61d98b46a6
commit 28c2dd2198
3 changed files with 3 additions and 12 deletions

View file

@ -189,7 +189,6 @@ typedef struct dds_writer
const struct dds_topic * m_topic;
struct nn_xpack * m_xp;
struct writer * m_wr;
os_mutex m_call_lock;
struct whc *m_whc; /* FIXME: ownership still with underlying DDSI writer (cos of DDSI built-in writers )*/
/* Status metrics */

View file

@ -219,7 +219,6 @@ dds_write_impl(
d->v.msginfo.statusinfo = ((action & DDS_WR_DISPOSE_BIT ) ? NN_STATUSINFO_DISPOSE : 0) |
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
d->v.msginfo.timestamp.v = tstamp;
os_mutexLock (&writer->m_call_lock);
ddsi_serdata_ref(d);
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (d);
w_rc = write_sample_gc (writer->m_xp, ddsi_wr, d, tk);
@ -237,8 +236,6 @@ dds_write_impl(
} else {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal error");
}
os_mutexUnlock (&writer->m_call_lock);
if (ret == DDS_RETCODE_OK) {
ret = deliver_locally (ddsi_wr, d, tk);
}
@ -285,11 +282,9 @@ dds_writecdr_impl(
((action & DDS_WR_DISPOSE_BIT ) ? NN_STATUSINFO_DISPOSE : 0) |
((action & DDS_WR_UNREGISTER_BIT) ? NN_STATUSINFO_UNREGISTER : 0) ;
d->v.msginfo.timestamp.v = tstamp;
os_mutexLock (&wr->m_call_lock);
ddsi_serdata_ref(d);
tk = (ddsi_plugin.rhc_plugin.rhc_lookup_fn) (d);
w_rc = write_sample_gc (wr->m_xp, ddsi_wr, d, tk);
if (w_rc >= 0) {
/* Flush out write unless configured to batch */
if (! config.whc_batch) {
@ -303,7 +298,6 @@ dds_writecdr_impl(
} else {
ret = DDS_ERRNO(DDS_RETCODE_ERROR, "Internal error");
}
os_mutexUnlock (&wr->m_call_lock);
if (ret == DDS_RETCODE_OK) {
ret = deliver_locally (ddsi_wr, d, tk);

View file

@ -252,7 +252,6 @@ dds_writer_delete(
ret = DDS_RETCODE_OK;
}
}
os_mutexDestroy(&wr->m_call_lock);
return ret;
}
@ -263,7 +262,6 @@ dds_writer_qos_validate(
bool enabled)
{
dds_return_t ret = DDS_RETCODE_OK;
bool consistent = true;
assert(qos);
@ -320,11 +318,12 @@ dds_writer_qos_set(
thread_state_awake (thr);
}
os_mutexLock (&((dds_writer*)e)->m_call_lock);
/* FIXME: with QoS changes being unsupported by the underlying stack I wonder what will happen; locking the underlying DDSI writer is of doubtful value as well */
os_mutexLock (&ddsi_wr->e.lock);
if (qos->ownership_strength.value != ddsi_wr->xqos->ownership_strength.value) {
ddsi_wr->xqos->ownership_strength.value = qos->ownership_strength.value;
}
os_mutexUnlock (&((dds_writer*)e)->m_call_lock);
os_mutexUnlock (&ddsi_wr->e.lock);
if (asleep) {
thread_state_asleep (thr);
@ -479,7 +478,6 @@ dds_create_writer(
wr->m_topic = (dds_topic*)tp;
dds_entity_add_ref_nolock(tp);
wr->m_xp = nn_xpack_new(conn, get_bandwidth_limit(wqos->transport_priority), config.xpack_send_async);
os_mutexInit (&wr->m_call_lock);
wr->m_entity.m_deriver.close = dds_writer_close;
wr->m_entity.m_deriver.delete = dds_writer_delete;
wr->m_entity.m_deriver.set_qos = dds_writer_qos_set;