forked from Mirror/frr
*: Use proper semantics for turning off thread
We have this pattern in the code base: if (thread) THREAD_OFF(thread); If we look at THREAD_OFF we check to see if thread is non-null too. So we have a double check. This is unnecessary. Convert to just using THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
8b6b6b694d
commit
28ef0ee121
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
#define BGP_TIMER_OFF(T) \
|
#define BGP_TIMER_OFF(T) \
|
||||||
do { \
|
do { \
|
||||||
if (T) \
|
|
||||||
THREAD_TIMER_OFF(T); \
|
THREAD_TIMER_OFF(T); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -3960,7 +3960,6 @@ static void bgp_route_map_mark_update(const char *rmap_name)
|
||||||
/* If new update is received before the current timer timed out,
|
/* If new update is received before the current timer timed out,
|
||||||
* turn it off and start a new timer.
|
* turn it off and start a new timer.
|
||||||
*/
|
*/
|
||||||
if (bm->t_rmap_update != NULL)
|
|
||||||
THREAD_OFF(bm->t_rmap_update);
|
THREAD_OFF(bm->t_rmap_update);
|
||||||
|
|
||||||
/* rmap_update_timer of 0 means don't do route updates */
|
/* rmap_update_timer of 0 means don't do route updates */
|
||||||
|
|
|
@ -795,16 +795,13 @@ static void update_subgroup_delete(struct update_subgroup *subgrp)
|
||||||
if (subgrp->update_group)
|
if (subgrp->update_group)
|
||||||
UPDGRP_INCR_STAT(subgrp->update_group, subgrps_deleted);
|
UPDGRP_INCR_STAT(subgrp->update_group, subgrps_deleted);
|
||||||
|
|
||||||
if (subgrp->t_merge_check)
|
|
||||||
THREAD_OFF(subgrp->t_merge_check);
|
THREAD_OFF(subgrp->t_merge_check);
|
||||||
|
|
||||||
if (subgrp->t_coalesce)
|
|
||||||
THREAD_TIMER_OFF(subgrp->t_coalesce);
|
THREAD_TIMER_OFF(subgrp->t_coalesce);
|
||||||
|
|
||||||
bpacket_queue_cleanup(SUBGRP_PKTQ(subgrp));
|
bpacket_queue_cleanup(SUBGRP_PKTQ(subgrp));
|
||||||
subgroup_clear_table(subgrp);
|
subgroup_clear_table(subgrp);
|
||||||
|
|
||||||
if (subgrp->t_coalesce)
|
|
||||||
THREAD_TIMER_OFF(subgrp->t_coalesce);
|
THREAD_TIMER_OFF(subgrp->t_coalesce);
|
||||||
sync_delete(subgrp);
|
sync_delete(subgrp);
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,6 @@ int eigrp_if_down(struct eigrp_interface *ei)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Shutdown packet reception and sending */
|
/* Shutdown packet reception and sending */
|
||||||
if (ei->t_hello)
|
|
||||||
THREAD_OFF(ei->t_hello);
|
THREAD_OFF(ei->t_hello);
|
||||||
|
|
||||||
eigrp_if_stream_unset(ei);
|
eigrp_if_stream_unset(ei);
|
||||||
|
|
|
@ -300,10 +300,7 @@ void isis_ldp_sync_ldp_fail(struct isis_circuit *circuit)
|
||||||
if (ldp_sync_info &&
|
if (ldp_sync_info &&
|
||||||
ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED &&
|
ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED &&
|
||||||
ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) {
|
ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) {
|
||||||
if (ldp_sync_info->t_holddown != NULL) {
|
|
||||||
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
||||||
ldp_sync_info->t_holddown = NULL;
|
|
||||||
}
|
|
||||||
ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
|
ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
|
||||||
isis_ldp_sync_set_if_metric(circuit, true);
|
isis_ldp_sync_set_if_metric(circuit, true);
|
||||||
}
|
}
|
||||||
|
@ -326,7 +323,6 @@ void isis_ldp_sync_if_remove(struct isis_circuit *circuit, bool remove)
|
||||||
ils_debug("ldp_sync: remove if %s", circuit->interface
|
ils_debug("ldp_sync: remove if %s", circuit->interface
|
||||||
? circuit->interface->name : "");
|
? circuit->interface->name : "");
|
||||||
|
|
||||||
if (ldp_sync_info->t_holddown)
|
|
||||||
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
||||||
ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED;
|
ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED;
|
||||||
isis_ldp_sync_set_if_metric(circuit, true);
|
isis_ldp_sync_set_if_metric(circuit, true);
|
||||||
|
|
|
@ -79,10 +79,8 @@ bool ldp_sync_if_down(struct ldp_sync_info *ldp_sync_info)
|
||||||
* update state
|
* update state
|
||||||
*/
|
*/
|
||||||
if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) {
|
if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) {
|
||||||
if (ldp_sync_info->t_holddown != NULL) {
|
|
||||||
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
||||||
ldp_sync_info->t_holddown = NULL;
|
|
||||||
}
|
|
||||||
if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_UP)
|
if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_UP)
|
||||||
ldp_sync_info->state =
|
ldp_sync_info->state =
|
||||||
LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
|
LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
|
||||||
|
|
|
@ -132,7 +132,6 @@ static int spf_backoff_holddown_elapsed(struct thread *thread)
|
||||||
{
|
{
|
||||||
struct spf_backoff *backoff = THREAD_ARG(thread);
|
struct spf_backoff *backoff = THREAD_ARG(thread);
|
||||||
|
|
||||||
backoff->t_holddown = NULL;
|
|
||||||
THREAD_TIMER_OFF(backoff->t_timetolearn);
|
THREAD_TIMER_OFF(backoff->t_timetolearn);
|
||||||
timerclear(&backoff->first_event_time);
|
timerclear(&backoff->first_event_time);
|
||||||
backoff->state = SPF_BACKOFF_QUIET;
|
backoff->state = SPF_BACKOFF_QUIET;
|
||||||
|
|
|
@ -274,10 +274,7 @@ void ospf_ldp_sync_ldp_fail(struct interface *ifp)
|
||||||
if (ldp_sync_info &&
|
if (ldp_sync_info &&
|
||||||
ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED &&
|
ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED &&
|
||||||
ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) {
|
ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) {
|
||||||
if (ldp_sync_info->t_holddown != NULL) {
|
|
||||||
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
||||||
ldp_sync_info->t_holddown = NULL;
|
|
||||||
}
|
|
||||||
ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
|
ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP;
|
||||||
ospf_if_recalculate_output_cost(ifp);
|
ospf_if_recalculate_output_cost(ifp);
|
||||||
}
|
}
|
||||||
|
@ -340,7 +337,6 @@ void ospf_ldp_sync_if_remove(struct interface *ifp, bool remove)
|
||||||
* restore cost
|
* restore cost
|
||||||
*/
|
*/
|
||||||
ols_debug("ldp_sync: Removed from if %s", ifp->name);
|
ols_debug("ldp_sync: Removed from if %s", ifp->name);
|
||||||
if (ldp_sync_info->t_holddown)
|
|
||||||
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
THREAD_TIMER_OFF(ldp_sync_info->t_holddown);
|
||||||
ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED;
|
ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED;
|
||||||
ospf_if_recalculate_output_cost(ifp);
|
ospf_if_recalculate_output_cost(ifp);
|
||||||
|
|
|
@ -117,7 +117,6 @@ static int pim_g2rp_list_compare(struct bsm_rpinfo *node1,
|
||||||
|
|
||||||
static void pim_free_bsrp_node(struct bsm_rpinfo *bsrp_info)
|
static void pim_free_bsrp_node(struct bsm_rpinfo *bsrp_info)
|
||||||
{
|
{
|
||||||
if (bsrp_info->g2rp_timer)
|
|
||||||
THREAD_OFF(bsrp_info->g2rp_timer);
|
THREAD_OFF(bsrp_info->g2rp_timer);
|
||||||
XFREE(MTYPE_PIM_BSRP_NODE, bsrp_info);
|
XFREE(MTYPE_PIM_BSRP_NODE, bsrp_info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -804,9 +804,7 @@ void igmp_group_delete(struct igmp_group *group)
|
||||||
igmp_source_delete(src);
|
igmp_source_delete(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group->t_group_query_retransmit_timer) {
|
|
||||||
THREAD_OFF(group->t_group_query_retransmit_timer);
|
THREAD_OFF(group->t_group_query_retransmit_timer);
|
||||||
}
|
|
||||||
|
|
||||||
group_timer_off(group);
|
group_timer_off(group);
|
||||||
igmp_group_count_decr(group->group_igmp_sock);
|
igmp_group_count_decr(group->group_igmp_sock);
|
||||||
|
|
|
@ -585,7 +585,6 @@ static void restart_done(struct daemon *dmn)
|
||||||
dmn->name, state_str[dmn->state]);
|
dmn->name, state_str[dmn->state]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dmn->t_wakeup)
|
|
||||||
THREAD_OFF(dmn->t_wakeup);
|
THREAD_OFF(dmn->t_wakeup);
|
||||||
if (try_connect(dmn) < 0)
|
if (try_connect(dmn) < 0)
|
||||||
SET_WAKEUP_DOWN(dmn);
|
SET_WAKEUP_DOWN(dmn);
|
||||||
|
|
Loading…
Reference in a new issue