]> git.proxmox.com Git - mirror_frr.git/commit - pimd/pim_zlookup.c
*: remove THREAD_ON macros, add nullity check
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 24 Apr 2017 22:33:25 +0000 (22:33 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 9 May 2017 20:44:19 +0000 (20:44 +0000)
commitffa2c8986d204f4a3e7204258fd6906af4a57c93
tree6242b8634bc2a264339a05dcfb20b94f63c252f4
parent7a78dea34d20e44539ccabb1b97e029003be4b40
*: remove THREAD_ON macros, add nullity check

The way thread.c is written, a caller who wishes to be able to cancel a
thread or avoid scheduling it twice must keep a reference to the thread.
Typically this is done with a long lived pointer whose value is checked
for null in order to know if the thread is currently scheduled.  The
check-and-schedule idiom is so common that several wrapper macros in
thread.h existed solely to provide it.

This patch removes those macros and adds a new parameter to all
thread_add_* functions which is a pointer to the struct thread * to
store the result of a scheduling call. If the value passed is non-null,
the thread will only be scheduled if the value is null. This helps with
consistency.

A Coccinelle spatch has been used to transform code of the form:

  if (t == NULL)
    t = thread_add_* (...)

to the form

  thread_add_* (..., &t)

The THREAD_ON macros have also been transformed to the underlying
thread.c calls.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
113 files changed:
bgpd/bgp_damp.c
bgpd/bgp_dump.c
bgpd/bgp_fsm.c
bgpd/bgp_fsm.h
bgpd/bgp_network.c
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgp_updgrp.c
bgpd/bgp_updgrp_adv.c
bgpd/bgpd.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_monitor.c
bgpd/rfapi/rfapi_rib.c
bgpd/rfapi/vnc_export_bgp.c
isisd/isis_circuit.c
isisd/isis_dr.c
isisd/isis_dynhn.c
isisd/isis_events.c
isisd/isis_lsp.c
isisd/isis_pdu.c
isisd/isis_spf.c
isisd/isisd.c
ldpd/accept.c
ldpd/adjacency.c
ldpd/control.c
ldpd/interface.c
ldpd/lde.c
ldpd/lde_lib.c
ldpd/ldpd.c
ldpd/ldpe.c
ldpd/neighbor.c
ldpd/packet.c
lib/agentx.c
lib/sigevent.c
lib/smux.c
lib/spf_backoff.c
lib/systemd.c
lib/thread.c
lib/thread.h
lib/vty.c
lib/wheel.c
lib/workqueue.c
lib/zclient.c
nhrpd/netlink_arp.c
nhrpd/nhrp_cache.c
nhrpd/nhrp_event.c
nhrpd/nhrp_nhs.c
nhrpd/nhrp_packet.c
nhrpd/nhrp_peer.c
nhrpd/nhrp_shortcut.c
nhrpd/resolver.c
nhrpd/vici.c
ospf6d/ospf6_bfd.c
ospf6d/ospf6_flood.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_intra.h
ospf6d/ospf6_lsa.c
ospf6d/ospf6_message.c
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_spf.c
ospf6d/ospf6_top.c
ospf6d/ospf6d.c
ospfclient/ospfclient.c
ospfd/ospf_abr.c
ospfd/ospf_apiserver.c
ospfd/ospf_ase.c
ospfd/ospf_ism.h
ospfd/ospf_lsa.c
ospfd/ospf_nsm.h
ospfd/ospf_opaque.c
ospfd/ospf_packet.c
ospfd/ospf_spf.c
ospfd/ospf_zebra.c
ospfd/ospfd.c
ospfd/ospfd.h
pimd/pim_assert.c
pimd/pim_ifchannel.c
pimd/pim_igmp.c
pimd/pim_igmpv3.c
pimd/pim_mroute.c
pimd/pim_msdp.c
pimd/pim_msdp.h
pimd/pim_msdp_socket.c
pimd/pim_neighbor.c
pimd/pim_pim.c
pimd/pim_ssmpingd.c
pimd/pim_upstream.c
pimd/pim_zebra.c
pimd/pim_zlookup.c
ripd/rip_interface.c
ripd/rip_peer.c
ripd/ripd.c
ripd/ripd.h
ripngd/ripng_interface.c
ripngd/ripng_peer.c
ripngd/ripngd.c
ripngd/ripngd.h
tests/helpers/c/main.c
tests/lib/test_heavy_thread.c
tests/lib/test_timer_correctness.c
tests/lib/test_timer_performance.c
watchfrr/watchfrr.c
zebra/irdp_interface.c
zebra/irdp_main.c
zebra/irdp_packet.c
zebra/kernel_netlink.c
zebra/kernel_socket.c
zebra/label_manager.c
zebra/rtadv.c
zebra/zebra_fpm.c
zebra/zebra_ptm.c
zebra/zebra_routemap.c
zebra/zserv.c