From 763ed6795871f4c0844cb868896ab52874bb7872 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Mon, 9 Mar 2020 14:02:30 +0100 Subject: [PATCH] Replace T_NEVER by DDS_NEVER, DDS_INFINITY Signed-off-by: Erik Boasson --- .../ddsi/include/dds/ddsi/ddsi_deadline.h | 12 +++--- .../ddsi/include/dds/ddsi/ddsi_lifespan.h | 4 +- src/core/ddsi/include/dds/ddsi/q_time.h | 7 ++-- src/core/ddsi/include/dds/ddsi/q_xevent.h | 4 +- src/core/ddsi/src/ddsi_plist.c | 14 +++---- src/core/ddsi/src/q_config.c | 6 +-- src/core/ddsi/src/q_ddsi_discovery.c | 8 ++-- src/core/ddsi/src/q_entity.c | 38 ++++++++----------- src/core/ddsi/src/q_init.c | 4 +- src/core/ddsi/src/q_lease.c | 10 ++--- src/core/ddsi/src/q_receive.c | 5 +-- src/core/ddsi/src/q_time.c | 14 +++---- src/core/ddsi/src/q_transmit.c | 4 +- src/core/ddsi/src/q_xevent.c | 28 +++++++------- src/core/ddsi/src/q_xmsg.c | 2 +- 15 files changed, 76 insertions(+), 84 deletions(-) diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_deadline.h b/src/core/ddsi/include/dds/ddsi/ddsi_deadline.h index 4903eca..7bb1044 100644 --- a/src/core/ddsi/include/dds/ddsi/ddsi_deadline.h +++ b/src/core/ddsi/include/dds/ddsi/ddsi_deadline.h @@ -48,30 +48,30 @@ DDS_EXPORT void deadline_renew_instance_real (struct deadline_adm *deadline_adm, inline void deadline_register_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem, nn_mtime_t tnow) { - if (deadline_adm->dur != T_NEVER) + if (deadline_adm->dur != DDS_INFINITY) deadline_register_instance_real (deadline_adm, elem, tnow, tnow); } inline void deadline_reregister_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem, nn_mtime_t tnow) { - if (deadline_adm->dur != T_NEVER) + if (deadline_adm->dur != DDS_INFINITY) deadline_register_instance_real (deadline_adm, elem, elem->t_deadline, tnow); } inline void deadline_unregister_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem) { - if (deadline_adm->dur != T_NEVER) + if (deadline_adm->dur != DDS_INFINITY) { - assert (elem->t_deadline.v != T_NEVER); + assert (elem->t_deadline.v != DDS_NEVER); deadline_unregister_instance_real (deadline_adm, elem); } } inline void deadline_renew_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem) { - if (deadline_adm->dur != T_NEVER) + if (deadline_adm->dur != DDS_INFINITY) { - assert (elem->t_deadline.v != T_NEVER); + assert (elem->t_deadline.v != DDS_NEVER); deadline_renew_instance_real (deadline_adm, elem); } } diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_lifespan.h b/src/core/ddsi/include/dds/ddsi/ddsi_lifespan.h index 7c1843c..e8202ee 100644 --- a/src/core/ddsi/include/dds/ddsi/ddsi_lifespan.h +++ b/src/core/ddsi/include/dds/ddsi/ddsi_lifespan.h @@ -43,13 +43,13 @@ DDS_EXPORT void lifespan_unregister_sample_real (struct lifespan_adm *lifespan_a inline void lifespan_register_sample_locked (struct lifespan_adm *lifespan_adm, struct lifespan_fhnode *node) { - if (node->t_expire.v != T_NEVER) + if (node->t_expire.v != DDS_NEVER) lifespan_register_sample_real (lifespan_adm, node); } inline void lifespan_unregister_sample_locked (struct lifespan_adm *lifespan_adm, struct lifespan_fhnode *node) { - if (node->t_expire.v != T_NEVER) + if (node->t_expire.v != DDS_NEVER) lifespan_unregister_sample_real (lifespan_adm, node); } diff --git a/src/core/ddsi/include/dds/ddsi/q_time.h b/src/core/ddsi/include/dds/ddsi/q_time.h index 3b22bee..1b99ee1 100644 --- a/src/core/ddsi/include/dds/ddsi/q_time.h +++ b/src/core/ddsi/include/dds/ddsi/q_time.h @@ -20,7 +20,6 @@ extern "C" { #endif -#define T_NEVER 0x7fffffffffffffffll #define T_MILLISECOND 1000000ll #define T_SECOND (1000 * T_MILLISECOND) #define T_MICROSECOND (T_MILLISECOND/1000) @@ -46,9 +45,9 @@ typedef struct { int64_t v; } nn_etime_t; -#define NN_MTIME_NEVER ((nn_mtime_t) { T_NEVER }) -#define NN_WCTIME_NEVER ((nn_wctime_t) { T_NEVER }) -#define NN_ETIME_NEVER ((nn_etime_t) { T_NEVER }) +#define NN_MTIME_NEVER ((nn_mtime_t) { DDS_NEVER }) +#define NN_WCTIME_NEVER ((nn_wctime_t) { DDS_NEVER }) +#define NN_ETIME_NEVER ((nn_etime_t) { DDS_NEVER }) #define NN_WCTIME_INVALID ((nn_wctime_t) { INT64_MIN }) int valid_ddsi_timestamp (ddsi_time_t t); diff --git a/src/core/ddsi/include/dds/ddsi/q_xevent.h b/src/core/ddsi/include/dds/ddsi/q_xevent.h index 6f43bac..3925ba6 100644 --- a/src/core/ddsi/include/dds/ddsi/q_xevent.h +++ b/src/core/ddsi/include/dds/ddsi/q_xevent.h @@ -43,7 +43,7 @@ struct xeventq *xeventq_new uint32_t auxiliary_bandwidth_limit ); -/* xeventq_free calls callback handlers with t = T_NEVER, at which point they are required to free +/* xeventq_free calls callback handlers with t = NEVER, at which point they are required to free whatever memory is claimed for the argument and call delete_xevent. */ DDS_EXPORT void xeventq_free (struct xeventq *evq); DDS_EXPORT dds_return_t xeventq_start (struct xeventq *evq, const char *name); /* <0 => error, =0 => ok */ @@ -68,7 +68,7 @@ DDS_EXPORT struct xevent *qxev_spdp (struct xeventq *evq, nn_mtime_t tsched, con DDS_EXPORT struct xevent *qxev_pmd_update (struct xeventq *evq, nn_mtime_t tsched, const ddsi_guid_t *pp_guid); DDS_EXPORT struct xevent *qxev_delete_writer (struct xeventq *evq, nn_mtime_t tsched, const ddsi_guid_t *guid); -/* cb will be called with now = T_NEVER if the event is still enqueued when when xeventq_free starts cleaning up */ +/* cb will be called with now = NEVER if the event is still enqueued when when xeventq_free starts cleaning up */ DDS_EXPORT struct xevent *qxev_callback (struct xeventq *evq, nn_mtime_t tsched, void (*cb) (struct xevent *xev, void *arg, nn_mtime_t now), void *arg); #if defined (__cplusplus) diff --git a/src/core/ddsi/src/ddsi_plist.c b/src/core/ddsi/src/ddsi_plist.c index 1ccac80..d967662 100644 --- a/src/core/ddsi/src/ddsi_plist.c +++ b/src/core/ddsi/src/ddsi_plist.c @@ -2803,14 +2803,14 @@ static void xqos_init_default_common (dds_qos_t *xqos) xqos->durability.kind = DDS_DURABILITY_VOLATILE; xqos->present |= QP_DEADLINE; - xqos->deadline.deadline = T_NEVER; + xqos->deadline.deadline = DDS_INFINITY; xqos->present |= QP_LATENCY_BUDGET; xqos->latency_budget.duration = 0; xqos->present |= QP_LIVELINESS; xqos->liveliness.kind = DDS_LIVELINESS_AUTOMATIC; - xqos->liveliness.lease_duration = T_NEVER; + xqos->liveliness.lease_duration = DDS_INFINITY; xqos->present |= QP_DESTINATION_ORDER; xqos->destination_order.kind = DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP; @@ -2866,12 +2866,12 @@ void ddsi_xqos_init_default_reader (dds_qos_t *xqos) xqos->time_based_filter.minimum_separation = 0; xqos->present |= QP_PRISMTECH_READER_DATA_LIFECYCLE; - xqos->reader_data_lifecycle.autopurge_nowriter_samples_delay = T_NEVER; - xqos->reader_data_lifecycle.autopurge_disposed_samples_delay = T_NEVER; + xqos->reader_data_lifecycle.autopurge_nowriter_samples_delay = DDS_INFINITY; + xqos->reader_data_lifecycle.autopurge_disposed_samples_delay = DDS_INFINITY; xqos->present |= QP_PRISMTECH_READER_LIFESPAN; xqos->reader_lifespan.use_lifespan = 0; - xqos->reader_lifespan.duration = T_NEVER; + xqos->reader_lifespan.duration = DDS_INFINITY; xqos->present |= QP_PRISMTECH_SUBSCRIPTION_KEYS; xqos->subscription_keys.use_key_list = 0; @@ -2902,7 +2902,7 @@ void ddsi_xqos_init_default_writer (dds_qos_t *xqos) xqos->transport_priority.value = 0; xqos->present |= QP_LIFESPAN; - xqos->lifespan.duration = T_NEVER; + xqos->lifespan.duration = DDS_INFINITY; xqos->present |= QP_PRISMTECH_WRITER_DATA_LIFECYCLE; xqos->writer_data_lifecycle.autodispose_unregistered_instances = 1; @@ -2934,7 +2934,7 @@ void ddsi_xqos_init_default_topic (dds_qos_t *xqos) xqos->transport_priority.value = 0; xqos->present |= QP_LIFESPAN; - xqos->lifespan.duration = T_NEVER; + xqos->lifespan.duration = DDS_INFINITY; xqos->present |= QP_PRISMTECH_SUBSCRIPTION_KEYS; xqos->subscription_keys.use_key_list = 0; diff --git a/src/core/ddsi/src/q_config.c b/src/core/ddsi/src/q_config.c index 2f3fbf6..4c666ff 100644 --- a/src/core/ddsi/src/q_config.c +++ b/src/core/ddsi/src/q_config.c @@ -1910,10 +1910,10 @@ static enum update_result uf_duration_inf (struct cfgst *cfgst, void *parent, st { if (ddsrt_strcasecmp (value, "inf") == 0) { int64_t * const elem = cfg_address (cfgst, parent, cfgelem); - *elem = T_NEVER; + *elem = DDS_INFINITY; return URES_SUCCESS; } else { - return uf_duration_gen (cfgst, parent, cfgelem, value, 0, 0, T_NEVER - 1); + return uf_duration_gen (cfgst, parent, cfgelem, value, 0, 0, DDS_INFINITY - 1); } } @@ -1940,7 +1940,7 @@ static enum update_result uf_duration_100ms_1hr (struct cfgst *cfgst, void *pare static void pf_duration (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources) { int64_t const * const elem = cfg_address (cfgst, parent, cfgelem); - if (*elem == T_NEVER) + if (*elem == DDS_INFINITY) cfg_logelem (cfgst, sources, "inf"); else pf_int64_unit (cfgst, *elem, sources, unittab_duration, "s"); diff --git a/src/core/ddsi/src/q_ddsi_discovery.c b/src/core/ddsi/src/q_ddsi_discovery.c index 0d3484d..f893b98 100644 --- a/src/core/ddsi/src/q_ddsi_discovery.c +++ b/src/core/ddsi/src/q_ddsi_discovery.c @@ -662,7 +662,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, seqno_t seq, nn_ GVLOGDISC (" (depends on "PGUIDFMT")", PGUID (privileged_pp_guid)); /* never expire lease for this proxy: it won't actually expire until the "privileged" one expires anyway */ - lease_duration = T_NEVER; + lease_duration = DDS_INFINITY; } else if (vendor_is_eclipse_or_opensplice (rst->vendor) && !(custom_flags & CF_PARTICIPANT_IS_DDSI2)) { @@ -674,7 +674,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, seqno_t seq, nn_ else { privileged_pp_guid.prefix = ddsi2->e.guid.prefix; - lease_duration = T_NEVER; + lease_duration = DDS_INFINITY; GVLOGDISC (" (depends on "PGUIDFMT")", PGUID (privileged_pp_guid)); } } @@ -1086,7 +1086,7 @@ static struct proxy_participant *implicitly_create_proxypp (struct ddsi_domaingv doing anything about (1). That means we fall back to the legacy mode of locally generating GIDs but leaving the system id unchanged if the remote is OSPL. */ actual_vendorid = (datap->present & PP_VENDORID) ? datap->vendorid : vendorid; - new_proxy_participant(gv, ppguid, 0, &privguid, new_addrset(), new_addrset(), &pp_plist, T_NEVER, actual_vendorid, CF_IMPLICITLY_CREATED_PROXYPP, timestamp, seq); + new_proxy_participant(gv, ppguid, 0, &privguid, new_addrset(), new_addrset(), &pp_plist, DDS_INFINITY, actual_vendorid, CF_IMPLICITLY_CREATED_PROXYPP, timestamp, seq); } else if (ppguid->prefix.u[0] == src_guid_prefix->u[0] && vendor_is_eclipse_or_opensplice (vendorid)) { @@ -1120,7 +1120,7 @@ static struct proxy_participant *implicitly_create_proxypp (struct ddsi_domaingv ddsrt_mutex_unlock (&privpp->e.lock); pp_plist.prismtech_participant_version_info.flags &= ~NN_PRISMTECH_FL_PARTICIPANT_IS_DDSI2; - new_proxy_participant (gv, ppguid, 0, &privguid, as_default, as_meta, &pp_plist, T_NEVER, vendorid, CF_IMPLICITLY_CREATED_PROXYPP | CF_PROXYPP_NO_SPDP, timestamp, seq); + new_proxy_participant (gv, ppguid, 0, &privguid, as_default, as_meta, &pp_plist, DDS_INFINITY, vendorid, CF_IMPLICITLY_CREATED_PROXYPP | CF_PROXYPP_NO_SPDP, timestamp, seq); } } diff --git a/src/core/ddsi/src/q_entity.c b/src/core/ddsi/src/q_entity.c index 0790a00..cf587ea 100644 --- a/src/core/ddsi/src/q_entity.c +++ b/src/core/ddsi/src/q_entity.c @@ -417,7 +417,7 @@ static void remember_deleted_participant_guid (struct deleted_participants_admin if ((n = ddsrt_malloc (sizeof (*n))) != NULL) { n->guid = *guid; - n->t_prune.v = T_NEVER; + n->t_prune = NN_MTIME_NEVER; n->for_what = DPG_LOCAL | DPG_REMOTE; ddsrt_avl_insert_ipath (&deleted_participants_treedef, &admin->deleted_participants, n, &path); } @@ -811,7 +811,7 @@ dds_return_t new_participant_guid (const ddsi_guid_t *ppguid, struct ddsi_domain { nn_mtime_t tsched; - tsched.v = (pp->lease_duration == T_NEVER) ? T_NEVER : 0; + tsched = (pp->lease_duration == DDS_INFINITY) ? NN_MTIME_NEVER : (nn_mtime_t){0}; pp->pmd_update_xevent = qxev_pmd_update (gv->xevents, tsched, &pp->e.guid); } return 0; @@ -1089,7 +1089,7 @@ dds_duration_t pp_get_pmd_interval (struct participant *pp) dds_duration_t intv; ddsrt_mutex_lock (&pp->e.lock); ldur_node = ddsrt_fibheap_min (&ldur_fhdef, &pp->ldur_auto_wr); - intv = (ldur_node != NULL) ? ldur_node->ldur : T_NEVER; + intv = (ldur_node != NULL) ? ldur_node->ldur : DDS_INFINITY; if (pp->lease_duration < intv) intv = pp->lease_duration; ddsrt_mutex_unlock (&pp->e.lock); @@ -2920,7 +2920,7 @@ void writer_set_alive_may_unlock (struct writer *wr, bool notify) ddsrt_mutex_lock (&wr->c.pp->e.lock); wr->alive = true; wr->alive_vclock++; - if (wr->xqos->liveliness.lease_duration != T_NEVER) + if (wr->xqos->liveliness.lease_duration != DDS_INFINITY) { if (wr->xqos->liveliness.kind == DDS_LIVELINESS_MANUAL_BY_PARTICIPANT) participant_add_wr_lease_locked (wr->c.pp, wr); @@ -2943,7 +2943,7 @@ static int writer_set_notalive_locked (struct writer *wr, bool notify) ddsrt_mutex_lock (&wr->c.pp->e.lock); wr->alive = false; wr->alive_vclock++; - if (wr->xqos->liveliness.lease_duration != T_NEVER && wr->xqos->liveliness.kind == DDS_LIVELINESS_MANUAL_BY_PARTICIPANT) + if (wr->xqos->liveliness.lease_duration != DDS_INFINITY && wr->xqos->liveliness.kind == DDS_LIVELINESS_MANUAL_BY_PARTICIPANT) participant_remove_wr_lease_locked (wr->c.pp, wr); ddsrt_mutex_unlock (&wr->c.pp->e.lock); @@ -3089,22 +3089,16 @@ static void new_writer_guid_common_init (struct writer *wr, const struct ddsi_se } /* heartbeat event will be deleted when the handler can't find a - writer for it in the hash table. T_NEVER => won't ever be + writer for it in the hash table. NEVER => won't ever be scheduled, and this can only change by writing data, which won't happen until after it becomes visible. */ if (wr->reliable) - { - nn_mtime_t tsched; - tsched.v = T_NEVER; - wr->heartbeat_xevent = qxev_heartbeat (wr->evq, tsched, &wr->e.guid); - } + wr->heartbeat_xevent = qxev_heartbeat (wr->evq, NN_MTIME_NEVER, &wr->e.guid); else - { wr->heartbeat_xevent = NULL; - } assert (wr->xqos->present & QP_LIVELINESS); - if (wr->xqos->liveliness.lease_duration != T_NEVER) + if (wr->xqos->liveliness.lease_duration != DDS_INFINITY) { wr->lease_duration = ddsrt_malloc (sizeof(*wr->lease_duration)); wr->lease_duration->ldur = wr->xqos->liveliness.lease_duration; @@ -3181,7 +3175,7 @@ static dds_return_t new_writer_guid (struct writer **wr_out, const struct ddsi_g if (wr->lease_duration != NULL) { - assert (wr->lease_duration->ldur != T_NEVER); + assert (wr->lease_duration->ldur != DDS_INFINITY); assert (!is_builtin_entityid (wr->e.guid.entityid, NN_VENDORID_ECLIPSE)); if (wr->xqos->liveliness.kind == DDS_LIVELINESS_AUTOMATIC) { @@ -3278,7 +3272,7 @@ static void gc_delete_writer (struct gcreq *gcreq) if (wr->heartbeat_xevent) { - wr->hbcontrol.tsched.v = T_NEVER; + wr->hbcontrol.tsched = NN_MTIME_NEVER; delete_xevent (wr->heartbeat_xevent); } @@ -4026,7 +4020,7 @@ void new_proxy_participant (struct ddsi_domaingv *gv, const struct ddsi_guid *pp lease that doesn't expire now and that has a "reasonable" lease duration. That way the lease renewal in the data path is fine, and we only need to do something special in SEDP handling. */ nn_etime_t texp = add_duration_to_etime (now_et(), tlease_dur); - dds_duration_t dur = (tlease_dur == T_NEVER) ? gv->config.lease_duration : tlease_dur; + dds_duration_t dur = (tlease_dur == DDS_INFINITY) ? gv->config.lease_duration : tlease_dur; proxypp->lease = lease_new (texp, dur, &proxypp->e); proxypp->owns_lease = 1; @@ -4529,7 +4523,7 @@ int new_proxy_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid, #endif assert (pwr->c.xqos->present & QP_LIVELINESS); - if (pwr->c.xqos->liveliness.lease_duration != T_NEVER) + if (pwr->c.xqos->liveliness.lease_duration != DDS_INFINITY) { nn_etime_t texpire = add_duration_to_etime (now_et (), pwr->c.xqos->liveliness.lease_duration); pwr->lease = lease_new (texpire, pwr->c.xqos->liveliness.lease_duration, &pwr->e); @@ -4689,7 +4683,7 @@ static void gc_delete_proxy_writer (struct gcreq *gcreq) free_pwr_rd_match (m); } local_reader_ary_fini (&pwr->rdary); - if (pwr->c.xqos->liveliness.lease_duration != T_NEVER) + if (pwr->c.xqos->liveliness.lease_duration != DDS_INFINITY) lease_free (pwr->lease); proxy_endpoint_common_fini (&pwr->e, &pwr->c); nn_defrag_free (pwr->defrag); @@ -4722,7 +4716,7 @@ int delete_proxy_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *guid, builtintopic_write (gv->builtin_topic_interface, &pwr->e, timestamp, false); entidx_remove_proxy_writer_guid (gv->entity_index, pwr); ddsrt_mutex_unlock (&gv->lock); - if (pwr->c.xqos->liveliness.lease_duration != T_NEVER && + if (pwr->c.xqos->liveliness.lease_duration != DDS_INFINITY && pwr->c.xqos->liveliness.kind == DDS_LIVELINESS_MANUAL_BY_TOPIC) lease_unregister (pwr->lease); if (proxy_writer_set_notalive (pwr, false) != DDS_RETCODE_OK) @@ -4768,7 +4762,7 @@ void proxy_writer_set_alive_may_unlock (struct proxy_writer *pwr, bool notify) ddsrt_mutex_lock (&pwr->c.proxypp->e.lock); pwr->alive = true; pwr->alive_vclock++; - if (pwr->c.xqos->liveliness.lease_duration != T_NEVER) + if (pwr->c.xqos->liveliness.lease_duration != DDS_INFINITY) { if (pwr->c.xqos->liveliness.kind != DDS_LIVELINESS_MANUAL_BY_TOPIC) proxy_participant_add_pwr_lease_locked (pwr->c.proxypp, pwr); @@ -4795,7 +4789,7 @@ int proxy_writer_set_notalive (struct proxy_writer *pwr, bool notify) ddsrt_mutex_lock (&pwr->c.proxypp->e.lock); pwr->alive = false; pwr->alive_vclock++; - if (pwr->c.xqos->liveliness.lease_duration != T_NEVER && pwr->c.xqos->liveliness.kind != DDS_LIVELINESS_MANUAL_BY_TOPIC) + if (pwr->c.xqos->liveliness.lease_duration != DDS_INFINITY && pwr->c.xqos->liveliness.kind != DDS_LIVELINESS_MANUAL_BY_TOPIC) proxy_participant_remove_pwr_lease_locked (pwr->c.proxypp, pwr); ddsrt_mutex_unlock (&pwr->c.proxypp->e.lock); diff --git a/src/core/ddsi/src/q_init.c b/src/core/ddsi/src/q_init.c index 7cb0fb3..2de55a2 100644 --- a/src/core/ddsi/src/q_init.c +++ b/src/core/ddsi/src/q_init.c @@ -952,7 +952,7 @@ int rtps_init (struct ddsi_domaingv *gv) uint32_t port_disc_uc = 0; uint32_t port_data_uc = 0; bool mc_available = true; - nn_mtime_t reset_deaf_mute_time = { T_NEVER }; + nn_mtime_t reset_deaf_mute_time = NN_MTIME_NEVER; gv->tstart = now (); /* wall clock time, used in logs */ @@ -1429,7 +1429,7 @@ int rtps_init (struct ddsi_domaingv *gv) gv->user_dqueue = nn_dqueue_new ("user", gv, gv->config.delivery_queue_maxsamples, user_dqueue_handler, NULL); #endif - if (reset_deaf_mute_time.v < T_NEVER) + if (reset_deaf_mute_time.v < DDS_NEVER) qxev_callback (gv->xevents, reset_deaf_mute_time, reset_deaf_mute, gv); return 0; diff --git a/src/core/ddsi/src/q_lease.c b/src/core/ddsi/src/q_lease.c index 7e8f9f3..e6e1747 100644 --- a/src/core/ddsi/src/q_lease.c +++ b/src/core/ddsi/src/q_lease.c @@ -110,7 +110,7 @@ void lease_register (struct lease *l) /* FIXME: make lease admin struct */ ddsrt_mutex_lock (&gv->leaseheap_lock); assert (l->tsched.v == TSCHED_NOT_ON_HEAP); int64_t tend = (int64_t) ddsrt_atomic_ld64 (&l->tend); - if (tend != T_NEVER) + if (tend != DDS_NEVER) { l->tsched.v = tend; ddsrt_fibheap_insert (&lease_fhdef, &gv->leaseheap, l); @@ -175,7 +175,7 @@ void lease_renew (struct lease *l, nn_etime_t tnowE) /* Only at this point we can assume that gv can be recovered from the entity in the * lease (i.e. the entity still exists). In cases where dereferencing l->entity->gv * is not safe (e.g. the deletion of entities), the early out in the loop above - * will be the case because tend is set to T_NEVER. */ + * will be the case because tend is set to DDS_NEVER. */ trace_lease_renew (l, "", tend_new); } @@ -197,7 +197,7 @@ void lease_set_expiry (struct lease *l, nn_etime_t when) trace_lease_renew (l, "earlier ", when); trigger = true; } - else if (l->tsched.v == TSCHED_NOT_ON_HEAP && when.v < T_NEVER) + else if (l->tsched.v == TSCHED_NOT_ON_HEAP && when.v < DDS_NEVER) { /* not currently scheduled, with a finite new expiry time */ l->tsched = when; @@ -229,7 +229,7 @@ int64_t check_and_handle_lease_expiration (struct ddsi_domaingv *gv, nn_etime_t int64_t tend = (int64_t) ddsrt_atomic_ld64 (&l->tend); if (tnowE.v < tend) { - if (tend == T_NEVER) { + if (tend == DDS_NEVER) { /* don't reinsert if it won't expire */ l->tsched.v = TSCHED_NOT_ON_HEAP; } else { @@ -302,7 +302,7 @@ int64_t check_and_handle_lease_expiration (struct ddsi_domaingv *gv, nn_etime_t ddsrt_mutex_lock (&gv->leaseheap_lock); } - delay = (l == NULL) ? T_NEVER : (l->tsched.v - tnowE.v); + delay = (l == NULL) ? DDS_INFINITY : (l->tsched.v - tnowE.v); ddsrt_mutex_unlock (&gv->leaseheap_lock); return delay; } diff --git a/src/core/ddsi/src/q_receive.c b/src/core/ddsi/src/q_receive.c index 7b138a8..07cb3cd 100644 --- a/src/core/ddsi/src/q_receive.c +++ b/src/core/ddsi/src/q_receive.c @@ -1072,8 +1072,7 @@ static void handle_Heartbeat_helper (struct pwr_rd_match * const wn, struct hand once, regardless of which readers care about it. */ if (wn->acknack_xevent) { - nn_mtime_t tsched; - tsched.v = T_NEVER; + nn_mtime_t tsched = NN_MTIME_NEVER; if (pwr->last_seq > refseq) { RSTTRACE ("/NAK"); @@ -1142,7 +1141,7 @@ static int handle_Heartbeat (struct receiver_state *rst, nn_etime_t tnow, struct ddsrt_mutex_lock (&pwr->e.lock); if (msg->smhdr.flags & HEARTBEAT_FLAG_LIVELINESS && pwr->c.xqos->liveliness.kind != DDS_LIVELINESS_AUTOMATIC && - pwr->c.xqos->liveliness.lease_duration != T_NEVER) + pwr->c.xqos->liveliness.lease_duration != DDS_INFINITY) { if ((lease = ddsrt_atomic_ldvoidp (&pwr->c.proxypp->minl_man)) != NULL) lease_renew (lease, tnow); diff --git a/src/core/ddsi/src/q_time.c b/src/core/ddsi/src/q_time.c index 79cfcf3..4fe4e69 100644 --- a/src/core/ddsi/src/q_time.c +++ b/src/core/ddsi/src/q_time.c @@ -75,7 +75,7 @@ nn_mtime_t mtime_round_up (nn_mtime_t t, int64_t round) t is nanoseconds, round is milliseconds. Avoid functions from maths libraries to keep code portable */ assert (t.v >= 0 && round >= 0); - if (round == 0 || t.v == T_NEVER) + if (round == 0 || t.v == DDS_INFINITY) { return t; } @@ -100,12 +100,12 @@ static int64_t add_duration_to_time (int64_t t, int64_t d) uint64_t sum; assert (t >= 0 && d >= 0); sum = (uint64_t)t + (uint64_t)d; - return sum >= T_NEVER ? T_NEVER : (int64_t)sum; + return sum >= DDS_NEVER ? DDS_NEVER : (int64_t)sum; } nn_mtime_t add_duration_to_mtime (nn_mtime_t t, int64_t d) { - /* assumed T_NEVER <=> MAX_INT64 */ + /* assumed DDS_NEVER <=> MAX_INT64 */ nn_mtime_t u; u.v = add_duration_to_time (t.v, d); return u; @@ -113,7 +113,7 @@ nn_mtime_t add_duration_to_mtime (nn_mtime_t t, int64_t d) nn_wctime_t add_duration_to_wctime (nn_wctime_t t, int64_t d) { - /* assumed T_NEVER <=> MAX_INT64 */ + /* assumed DDS_NEVER <=> MAX_INT64 */ nn_wctime_t u; u.v = add_duration_to_time (t.v, d); return u; @@ -121,7 +121,7 @@ nn_wctime_t add_duration_to_wctime (nn_wctime_t t, int64_t d) nn_etime_t add_duration_to_etime (nn_etime_t t, int64_t d) { - /* assumed T_NEVER <=> MAX_INT64 */ + /* assumed DDS_NEVER <=> MAX_INT64 */ nn_etime_t u; u.v = add_duration_to_time (t.v, d); return u; @@ -134,7 +134,7 @@ int valid_ddsi_timestamp (ddsi_time_t t) static ddsi_time_t nn_to_ddsi_time (int64_t t) { - if (t == T_NEVER) + if (t == DDS_NEVER) return DDSI_TIME_INFINITE; else { @@ -157,7 +157,7 @@ ddsi_time_t nn_wctime_to_ddsi_time (nn_wctime_t t) static int64_t nn_from_ddsi_time (ddsi_time_t x) { if (x.seconds == DDSI_TIME_INFINITE.seconds && x.fraction == DDSI_TIME_INFINITE.fraction) - return T_NEVER; + return DDS_NEVER; else { /* Round-to-nearest conversion of DDSI time fraction to nanoseconds */ diff --git a/src/core/ddsi/src/q_transmit.c b/src/core/ddsi/src/q_transmit.c index d412613..ef41d6d 100644 --- a/src/core/ddsi/src/q_transmit.c +++ b/src/core/ddsi/src/q_transmit.c @@ -58,7 +58,7 @@ void writer_hbcontrol_init (struct hbcontrol *hbc) hbc->t_of_last_write.v = 0; hbc->t_of_last_hb.v = 0; hbc->t_of_last_ackhb.v = 0; - hbc->tsched.v = T_NEVER; + hbc->tsched = NN_MTIME_NEVER; hbc->hbs_since_last_write = 0; hbc->last_packetid = 0; } @@ -306,7 +306,7 @@ struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_ ETRACE (wr, "heartbeat(wr "PGUIDFMT"%s) piggybacked, resched in %g s (min-ack %"PRId64"%s, avail-seq %"PRId64", xmit %"PRId64")\n", PGUID (wr->e.guid), *hbansreq ? "" : " final", - (hbc->tsched.v == T_NEVER) ? INFINITY : (double) (hbc->tsched.v - tnow.v) / 1e9, + (hbc->tsched.v == DDS_NEVER) ? INFINITY : (double) (hbc->tsched.v - tnow.v) / 1e9, ddsrt_avl_is_empty (&wr->readers) ? -1 : root_rdmatch (wr)->min_seq, ddsrt_avl_is_empty (&wr->readers) || root_rdmatch (wr)->all_have_replied_to_hb ? "" : "!", whcst->max_seq, writer_read_seq_xmit (wr)); diff --git a/src/core/ddsi/src/q_xevent.c b/src/core/ddsi/src/q_xevent.c index 7c3b777..7860d75 100644 --- a/src/core/ddsi/src/q_xevent.c +++ b/src/core/ddsi/src/q_xevent.c @@ -321,7 +321,7 @@ void delete_xevent (struct xevent *ev) /* Can delete it only once, no matter how we implement it internally */ assert (ev->tsched.v != TSCHED_DELETE); assert (TSCHED_DELETE < ev->tsched.v); - if (ev->tsched.v != T_NEVER) + if (ev->tsched.v != DDS_NEVER) { ev->tsched.v = TSCHED_DELETE; ddsrt_fibheap_decrease_key (&evq_xevents_fhdef, &evq->xevents, ev); @@ -343,13 +343,13 @@ void delete_xevent_callback (struct xevent *ev) assert (ev->kind == XEVK_CALLBACK); ddsrt_mutex_lock (&evq->lock); /* wait until neither scheduled nor executing; loop in case the callback reschedules the event */ - while (ev->tsched.v != T_NEVER || ev->u.callback.executing) + while (ev->tsched.v != DDS_NEVER || ev->u.callback.executing) { - if (ev->tsched.v != T_NEVER) + if (ev->tsched.v != DDS_NEVER) { assert (ev->tsched.v != TSCHED_DELETE); ddsrt_fibheap_delete (&evq_xevents_fhdef, &evq->xevents, ev); - ev->tsched.v = T_NEVER; + ev->tsched.v = DDS_NEVER; } if (ev->u.callback.executing) { @@ -364,7 +364,7 @@ int resched_xevent_if_earlier (struct xevent *ev, nn_mtime_t tsched) { struct xeventq *evq = ev->evq; int is_resched; - if (tsched.v == T_NEVER) + if (tsched.v == DDS_NEVER) return 0; ddsrt_mutex_lock (&evq->lock); /* If you want to delete it, you to say so by calling the right @@ -377,7 +377,7 @@ int resched_xevent_if_earlier (struct xevent *ev, nn_mtime_t tsched) else { nn_mtime_t tbefore = earliest_in_xeventq (evq); - if (ev->tsched.v != T_NEVER) + if (ev->tsched.v != DDS_NEVER) { ev->tsched = tsched; ddsrt_fibheap_decrease_key (&evq_xevents_fhdef, &evq->xevents, ev); @@ -405,7 +405,7 @@ static struct xevent *qxev_common (struct xeventq *evq, nn_mtime_t tsched, enum ASSERT_MUTEX_HELD (&evq->lock); /* round up the scheduled time if required */ - if (tsched.v != T_NEVER && evq->gv->config.schedule_time_rounding != 0) + if (tsched.v != DDS_NEVER && evq->gv->config.schedule_time_rounding != 0) { nn_mtime_t tsched_rounded = mtime_round_up (tsched, evq->gv->config.schedule_time_rounding); EVQTRACE ("rounded event scheduled for %"PRId64" to %"PRId64"\n", tsched.v, tsched_rounded.v); @@ -440,7 +440,7 @@ static void qxev_insert (struct xevent *ev) event administration. */ struct xeventq *evq = ev->evq; ASSERT_MUTEX_HELD (&evq->lock); - if (ev->tsched.v != T_NEVER) + if (ev->tsched.v != DDS_NEVER) { nn_mtime_t tbefore = earliest_in_xeventq (evq); ddsrt_fibheap_insert (&evq_xevents_fhdef, &evq->xevents, ev); @@ -606,7 +606,7 @@ static void handle_xevk_heartbeat (struct nn_xpack *xp, struct xevent *ev, nn_mt { hbansreq = 1; /* just for trace */ msg = NULL; /* Need not send it now, and no need to schedule it for the future */ - t_next.v = T_NEVER; + t_next.v = DDS_NEVER; } else if (!writer_hbcontrol_must_send (wr, &whcst, tnow)) { @@ -625,7 +625,7 @@ static void handle_xevk_heartbeat (struct nn_xpack *xp, struct xevent *ev, nn_mt PGUID (wr->e.guid), hbansreq ? "" : " final", msg ? "sent" : "suppressed", - (t_next.v == T_NEVER) ? INFINITY : (double)(t_next.v - tnow.v) / 1e9, + (t_next.v == DDS_NEVER) ? INFINITY : (double)(t_next.v - tnow.v) / 1e9, ddsrt_avl_is_empty (&wr->readers) ? (seqno_t) -1 : ((struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->min_seq, ddsrt_avl_is_empty (&wr->readers) || ((struct wr_prd_match *) ddsrt_avl_root_non_empty (&wr_readers_treedef, &wr->readers))->all_have_replied_to_hb ? "" : "!", whcst.max_seq, writer_read_seq_xmit (wr)); @@ -1111,9 +1111,9 @@ static void handle_xevk_pmd_update (struct thread_state1 * const ts1, struct nn_ write_pmd_message (ts1, xp, pp, PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE); intv = pp_get_pmd_interval (pp); - if (intv == T_NEVER) + if (intv == DDS_INFINITY) { - tnext.v = T_NEVER; + tnext.v = DDS_NEVER; GVTRACE ("resched pmd("PGUIDFMT"): never\n", PGUID (pp->e.guid)); } else @@ -1258,7 +1258,7 @@ static void handle_xevents (struct thread_state1 * const ts1, struct xeventq *xe determine whether it is currently on the heap or not (i.e., scheduled or not), so set to TSCHED_NEVER to indicate it currently isn't. */ - xev->tsched.v = T_NEVER; + xev->tsched.v = DDS_NEVER; thread_state_awake_to_awake_no_nest (ts1); handle_timed_xevent (ts1, xev, xp, tnow); } @@ -1314,7 +1314,7 @@ static uint32_t xevent_thread (struct xeventq * xevq) else { nn_mtime_t twakeup = earliest_in_xeventq (xevq); - if (twakeup.v == T_NEVER) + if (twakeup.v == DDS_NEVER) { /* no scheduled events nor any non-timed events */ ddsrt_cond_wait (&xevq->cond, &xevq->lock); diff --git a/src/core/ddsi/src/q_xmsg.c b/src/core/ddsi/src/q_xmsg.c index 6a3de18..dffe31a 100644 --- a/src/core/ddsi/src/q_xmsg.c +++ b/src/core/ddsi/src/q_xmsg.c @@ -952,7 +952,7 @@ static void nn_xpack_reinit (struct nn_xpack *xp) xp->call_flags = 0; xp->msg_len.length = 0; xp->included_msgs.latest = NULL; - xp->maxdelay = T_NEVER; + xp->maxdelay = DDS_INFINITY; #ifdef DDSI_INCLUDE_NETWORK_PARTITIONS xp->encoderId = 0; #endif