]> git.puffer.fish Git - matthieu/frr.git/commitdiff
*: update thread_add_* calls
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 5 May 2017 21:22:25 +0000 (21:22 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 9 May 2017 20:44:22 +0000 (20:44 +0000)
Pass pointer to pointer instead of assigning by return value. See
previous commit message.

To ensure that the behavior stays functionally correct, any assignments
with the result of a thread_add* function have been transformed to set
the pointer to null before passing it. These can be removed wherever the
pointer is known to already be null.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
57 files changed:
bgpd/bgp_damp.c
bgpd/bgp_dump.c
bgpd/bgp_network.c
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgp_updgrp.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_monitor.c
bgpd/rfapi/rfapi_rib.c
bgpd/rfapi/vnc_export_bgp.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/vty.c
lib/workqueue.c
lib/zclient.c
ospf6d/ospf6_flood.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_lsa.c
ospf6d/ospf6_message.c
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_spf.c
ospf6d/ospf6_top.c
ospfd/ospf_apiserver.c
ospfd/ospf_lsa.c
ospfd/ospf_opaque.c
ospfd/ospf_packet.c
ospfd/ospf_spf.c
ospfd/ospf_zebra.c
ospfd/ospfd.c
pimd/pim_msdp_socket.c
pimd/pim_zlookup.c
ripd/rip_peer.c
ripd/ripd.c
ripngd/ripng_peer.c
ripngd/ripngd.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/zebra_fpm.c
zebra/zebra_ptm.c
zebra/zebra_routemap.c
zebra/zserv.c

index 333f58061feda0bc896c718b26d9b93cb4befc65..114e641ebd0d4be978b13d1364feb482fe7ac554 100644 (file)
@@ -116,8 +116,8 @@ bgp_reuse_timer (struct thread *t)
   time_t t_now, t_diff;
     
   damp->t_reuse = NULL;
-  damp->t_reuse =
-    thread_add_timer(bm->master, bgp_reuse_timer, NULL, DELTA_REUSE, NULL);
+  thread_add_timer(bm->master, bgp_reuse_timer, NULL, DELTA_REUSE,
+                   &damp->t_reuse);
 
   t_now = bgp_clock ();
 
index 2e4520c19e9f447e0563ef5f873de94833df3c85..10ddf1660c71f1b424893b7829375f1ad12890f6 100644 (file)
@@ -171,16 +171,16 @@ bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval)
          secs_into_day = tm->tm_sec + 60*tm->tm_min + 60*60*tm->tm_hour;
          interval = interval - secs_into_day % interval; /* always > 0 */
        }
-      bgp_dump->t_interval = thread_add_timer(bm->master,
-                                              bgp_dump_interval_func,
-                                              bgp_dump, interval, NULL);
+      bgp_dump->t_interval = NULL;
+      thread_add_timer(bm->master, bgp_dump_interval_func, bgp_dump, interval,
+                       &bgp_dump->t_interval);
     }
   else
     {
       /* One-off dump: execute immediately, don't affect any scheduled dumps */
-      bgp_dump->t_interval = thread_add_event(bm->master,
-                                              bgp_dump_interval_func,
-                                              bgp_dump, 0, NULL);
+      bgp_dump->t_interval = NULL;
+      thread_add_event(bm->master, bgp_dump_interval_func, bgp_dump, 0,
+                       &bgp_dump->t_interval);
     }
 
   return 0;
index 556b4bedc7d6a390273f5fb5cfddedbbd1df15fe..b64d902d88343476e93d20064dc2b1d0a44a2a2d 100644 (file)
@@ -297,8 +297,9 @@ bgp_accept (struct thread *thread)
       zlog_err ("accept_sock is nevative value %d", accept_sock);
       return -1;
     }
-  listener->thread = thread_add_read(bm->master, bgp_accept, listener,
-                                     accept_sock, NULL);
+  listener->thread = NULL;
+  thread_add_read(bm->master, bgp_accept, listener, accept_sock,
+                  &listener->thread);
 
   /* Accept client connection. */
   bgp_sock = sockunion_accept (accept_sock, &su);
@@ -705,8 +706,8 @@ bgp_listener (int sock, struct sockaddr *sa, socklen_t salen)
   listener = XMALLOC (MTYPE_BGP_LISTENER, sizeof(*listener));
   listener->fd = sock;
   memcpy(&listener->su, sa, salen);
-  listener->thread = thread_add_read(bm->master, bgp_accept, listener, sock,
-                                     NULL);
+  listener->thread = NULL;
+  thread_add_read(bm->master, bgp_accept, listener, sock, &listener->thread);
   listnode_add (bm->listen_sockets, listener);
 
   return 0;
index 13b837a3f4d736b83802ec7478d5dc0d17f4d3c0..02b029d9ee0809d63abc928109dfc7a7ec045788 100644 (file)
@@ -3089,9 +3089,6 @@ bgp_announce_route_timer_expired (struct thread *t)
   paf = THREAD_ARG (t);
   peer = paf->peer;
 
-  assert (paf->t_announce_route);
-  paf->t_announce_route = NULL;
-
   if (peer->status != Established)
     return 0;
 
index 88f48cb90316f1e9f2970b3007b820f30c6dac1b..4563ec85f684b4c02585390fc24b7fd4e66bcb3f 100644 (file)
@@ -3176,9 +3176,9 @@ bgp_route_map_mark_update (const char *rmap_name)
       /* rmap_update_timer of 0 means don't do route updates */
       if (bm->rmap_update_timer)
         {
-          bm->t_rmap_update =
-            thread_add_timer(bm->master, bgp_route_map_update_timer, NULL,
-                             bm->rmap_update_timer, NULL);
+          bm->t_rmap_update = NULL;
+          thread_add_timer(bm->master, bgp_route_map_update_timer, NULL, bm->rmap_update_timer,
+                           &bm->t_rmap_update);
 
           /* Signal the groups that a route-map update event has started */
           for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
index 65b569c37f63d4971214e53206c0d0fae61a51a5..09089a3b3f7556abbb47661eca38fba75497b1c7 100644 (file)
@@ -1169,9 +1169,9 @@ update_subgroup_trigger_merge_check (struct update_subgroup *subgrp,
   if (!force && !update_subgroup_ready_for_merge (subgrp))
     return 0;
 
-  subgrp->t_merge_check =
-    thread_add_background(bm->master, update_subgroup_merge_check_thread_cb,
-                          subgrp, 0, NULL);
+  subgrp->t_merge_check = NULL;
+  thread_add_background(bm->master, update_subgroup_merge_check_thread_cb, subgrp, 0,
+                        &subgrp->t_merge_check);
 
   SUBGRP_INCR_STAT (subgrp, merge_checks_triggered);
 
index e91bc27ba0d2854f72cee6f1a194bb5bcb76138e..bef4b64d27ec33ab489debc9dfc425aa80304097 100644 (file)
@@ -3033,9 +3033,9 @@ rfapiBiStartWithdrawTimer (
   if (lifetime > UINT32_MAX / 1001)
     {
       /* sub-optimal case, but will probably never happen */
-      bi->extra->vnc.import.timer = thread_add_timer(bm->master,
-                                                     timer_service_func, wcb,
-                                                     lifetime, NULL);
+      bi->extra->vnc.import.timer = NULL;
+      thread_add_timer(bm->master, timer_service_func, wcb, lifetime,
+                       &bi->extra->vnc.import.timer);
     }
   else
     {
@@ -3051,10 +3051,9 @@ rfapiBiStartWithdrawTimer (
 
       lifetime_msec = (lifetime * 1000) + jitter;
 
-      bi->extra->vnc.import.timer = thread_add_background(bm->master,
-                                                          timer_service_func,
-                                                          wcb, lifetime_msec,
-                                                          NULL);
+      bi->extra->vnc.import.timer = NULL;
+      thread_add_background(bm->master, timer_service_func, wcb, lifetime_msec,
+                            &bi->extra->vnc.import.timer);
     }
 
   /* re-sort route list (BGP_INFO_REMOVED routes are last) */
index cd884a0adb744f9c0922f9a0ad7c5dd22d1358e5..8eeed0216c2c68e410d67b8169665f00ca5ba48f 100644 (file)
@@ -852,8 +852,9 @@ rfapiMonitorTimerRestart (struct rfapi_monitor_vpn *m)
                 rfapi_ntop (m->p.family, m->p.u.val, buf, BUFSIZ),
                 m->rfd->response_lifetime);
   }
-  m->timer = thread_add_timer(bm->master, rfapiMonitorTimerExpire, m,
-                              m->rfd->response_lifetime, NULL);
+  m->timer = NULL;
+  thread_add_timer(bm->master, rfapiMonitorTimerExpire, m, m->rfd->response_lifetime,
+                   &m->timer);
 }
 
 /* 
@@ -1183,8 +1184,9 @@ rfapiMonitorEthTimerRestart (struct rfapi_monitor_eth *m)
                 rfapiEthAddr2Str (&m->macaddr, buf, BUFSIZ),
                 m->rfd->response_lifetime);
   }
-  m->timer = thread_add_timer(bm->master, rfapiMonitorEthTimerExpire, m,
-                              m->rfd->response_lifetime, NULL);
+  m->timer = NULL;
+  thread_add_timer(bm->master, rfapiMonitorEthTimerExpire, m, m->rfd->response_lifetime,
+                   &m->timer);
 }
 
 static int
index 654da95a41c13f2229dfd9a92fbeae823eab5b15..b59db3ab562cad4006d2c070af72b40af97d3a04 100644 (file)
@@ -400,8 +400,9 @@ rfapiRibStartTimer (
   prefix2str (&rn->p, buf_prefix, BUFSIZ);
   vnc_zlog_debug_verbose ("%s: rfd %p pfx %s life %u", __func__, rfd, buf_prefix,
               ri->lifetime);
-  ri->timer = thread_add_timer(bm->master, rfapiRibExpireTimer, tcb,
-                               ri->lifetime, NULL);
+  ri->timer = NULL;
+  thread_add_timer(bm->master, rfapiRibExpireTimer, tcb, ri->lifetime,
+                   &ri->timer);
   assert (ri->timer);
 }
 
index fd97f2cd136b263b597d1dc8b070a08fe8df3061..55eda907c80faa7d928685cc075632833d63f5b5 100644 (file)
@@ -1856,8 +1856,9 @@ vnc_direct_bgp_rh_del_route (
 
   if (!eti->timer && eti->lifetime <= INT32_MAX)
     {
-      eti->timer = thread_add_timer(bm->master, vncExportWithdrawTimer, eti,
-                                    eti->lifetime, NULL);
+      eti->timer = NULL;
+      thread_add_timer(bm->master, vncExportWithdrawTimer, eti, eti->lifetime,
+                       &eti->timer);
       vnc_zlog_debug_verbose ("%s: set expiration timer for %u seconds",
                   __func__, eti->lifetime);
     }
index 5b1dacc30830c7b691a80e08e6b0d823f4e22020..323558d7fd2581b6bb0a1e6f67294656115eaee6 100644 (file)
@@ -58,7 +58,8 @@ accept_add(int fd, int (*cb)(struct thread *), void *arg)
        av->arg = arg;
        LIST_INSERT_HEAD(&accept_queue.queue, av, entry);
 
-       av->ev = thread_add_read(master, accept_cb, av, av->fd, NULL);
+       av->ev = NULL;
+       thread_add_read(master, accept_cb, av, av->fd, &av->ev);
 
        log_debug("%s: accepting on fd %d", __func__, fd);
 
@@ -85,8 +86,8 @@ accept_pause(void)
 {
        log_debug(__func__);
        accept_unarm();
-       accept_queue.evt = thread_add_timer(master, accept_timeout, NULL, 1,
-                                           NULL);
+       accept_queue.evt = NULL;
+       thread_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt);
 }
 
 void
@@ -103,8 +104,10 @@ static void
 accept_arm(void)
 {
        struct accept_ev        *av;
-       LIST_FOREACH(av, &accept_queue.queue, entry)
-               av->ev = thread_add_read(master, accept_cb, av, av->fd, NULL);
+       LIST_FOREACH(av, &accept_queue.queue, entry) {
+               av->ev = NULL;
+               thread_add_read(master, accept_cb, av, av->fd, &av->ev);
+       }
 }
 
 static void
@@ -119,7 +122,8 @@ static int
 accept_cb(struct thread *thread)
 {
        struct accept_ev        *av = THREAD_ARG(thread);
-       av->ev = thread_add_read(master, accept_cb, av, av->fd, NULL);
+       av->ev = NULL;
+       thread_add_read(master, accept_cb, av, av->fd, &av->ev);
        av->accept_cb(thread);
 
        return (0);
index e8bc58b7e85a44bd9dd0ec8c03c1e0153ff6a8e8..52e27766546e24c9f95cc82fb7fd37bbb445679d 100644 (file)
@@ -206,8 +206,9 @@ void
 adj_start_itimer(struct adj *adj)
 {
        THREAD_TIMER_OFF(adj->inactivity_timer);
-       adj->inactivity_timer = thread_add_timer(master, adj_itimer, adj,
-                                                adj->holdtime, NULL);
+       adj->inactivity_timer = NULL;
+       thread_add_timer(master, adj_itimer, adj, adj->holdtime,
+                        &adj->inactivity_timer);
 }
 
 void
@@ -366,9 +367,9 @@ static void
 tnbr_start_hello_timer(struct tnbr *tnbr)
 {
        THREAD_TIMER_OFF(tnbr->hello_timer);
-       tnbr->hello_timer = thread_add_timer(master, tnbr_hello_timer, tnbr,
-                                            tnbr_get_hello_interval(tnbr),
-                                            NULL);
+       tnbr->hello_timer = NULL;
+       thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
+                        &tnbr->hello_timer);
 }
 
 static void
index 40d8007d760ecdae0fad42e7973851936e5175ae..cde99dc8a9927391d0048bb3247820c7cf2ce450 100644 (file)
@@ -133,8 +133,9 @@ control_accept(struct thread *thread)
 
        imsg_init(&c->iev.ibuf, connfd);
        c->iev.handler_read = control_dispatch_imsg;
-       c->iev.ev_read = thread_add_read(master, c->iev.handler_read, &c->iev,
-                                        c->iev.ibuf.fd, NULL);
+       c->iev.ev_read = NULL;
+       thread_add_read(master, c->iev.handler_read, &c->iev, c->iev.ibuf.fd,
+                       &c->iev.ev_read);
        c->iev.handler_write = ldp_write_handler;
        c->iev.ev_write = NULL;
 
index 42f6ca5f381bb75818e725574bfeb5f28ce3e84f..a064a58b2e15c5fd44a2ee9685a8de9a9a22e985 100644 (file)
@@ -440,8 +440,9 @@ static void
 if_start_hello_timer(struct iface_af *ia)
 {
        THREAD_TIMER_OFF(ia->hello_timer);
-       ia->hello_timer = thread_add_timer(master, if_hello_timer, ia,
-                                          if_get_hello_interval(ia), NULL);
+       ia->hello_timer = NULL;
+       thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
+                        &ia->hello_timer);
 }
 
 static void
index 2d87161ec2ef387c1172af69082f8edaa69fa177..bef35f3194283bdf3035829062e068df51ab817c 100644 (file)
@@ -140,8 +140,9 @@ lde(void)
                fatal(NULL);
        imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC);
        iev_main->handler_read = lde_dispatch_parent;
-       iev_main->ev_read = thread_add_read(master, iev_main->handler_read,
-                                           iev_main, iev_main->ibuf.fd, NULL);
+       iev_main->ev_read = NULL;
+       thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd,
+                       &iev_main->ev_read);
        iev_main->handler_write = ldp_write_handler;
 
        if ((iev_main_sync = calloc(1, sizeof(struct imsgev))) == NULL)
@@ -526,11 +527,9 @@ lde_dispatch_parent(struct thread *thread)
                                fatal(NULL);
                        imsg_init(&iev_ldpe->ibuf, fd);
                        iev_ldpe->handler_read = lde_dispatch_imsg;
-                       iev_ldpe->ev_read = thread_add_read(master,
-                                                           iev_ldpe->handler_read,
-                                                           iev_ldpe,
-                                                           iev_ldpe->ibuf.fd,
-                                                           NULL);
+                       iev_ldpe->ev_read = NULL;
+                       thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd,
+                                       &iev_ldpe->ev_read);
                        iev_ldpe->handler_write = ldp_write_handler;
                        iev_ldpe->ev_write = NULL;
                        break;
index 0585a776ade043bc0f6aa0f44637a11ff31a8f3d..89aa6d4201593d64f8735bb04c494ddfd8705c26 100644 (file)
@@ -932,8 +932,9 @@ void
 lde_gc_start_timer(void)
 {
        THREAD_TIMER_OFF(gc_timer);
-       gc_timer = thread_add_timer(master, lde_gc_timer, NULL,
-                                   LDE_GC_INTERVAL, NULL);
+       gc_timer = NULL;
+       thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL,
+                        &gc_timer);
 }
 
 void
index 1fbb4d67f03ff428f8ed151550f553f525045052..a0b021dfd9b3dda13f05a6dba5124468c42340d9 100644 (file)
@@ -358,30 +358,30 @@ main(int argc, char *argv[])
                fatal(NULL);
        imsg_init(&iev_ldpe->ibuf, pipe_parent2ldpe[0]);
        iev_ldpe->handler_read = main_dispatch_ldpe;
-       iev_ldpe->ev_read = thread_add_read(master, iev_ldpe->handler_read,
-                                           iev_ldpe, iev_ldpe->ibuf.fd, NULL);
+       iev_ldpe->ev_read = NULL;
+       thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd,
+                       &iev_ldpe->ev_read);
        iev_ldpe->handler_write = ldp_write_handler;
 
        imsg_init(&iev_ldpe_sync->ibuf, pipe_parent2ldpe_sync[0]);
        iev_ldpe_sync->handler_read = main_dispatch_ldpe;
-       iev_ldpe_sync->ev_read = thread_add_read(master,
-                                                iev_ldpe_sync->handler_read,
-                                                iev_ldpe_sync,
-                                                iev_ldpe_sync->ibuf.fd, NULL);
+       iev_ldpe_sync->ev_read = NULL;
+       thread_add_read(master, iev_ldpe_sync->handler_read, iev_ldpe_sync, iev_ldpe_sync->ibuf.fd,
+                       &iev_ldpe_sync->ev_read);
        iev_ldpe_sync->handler_write = ldp_write_handler;
 
        imsg_init(&iev_lde->ibuf, pipe_parent2lde[0]);
        iev_lde->handler_read = main_dispatch_lde;
-       iev_lde->ev_read = thread_add_read(master, iev_lde->handler_read,
-                                          iev_lde, iev_lde->ibuf.fd, NULL);
+       iev_lde->ev_read = NULL;
+       thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd,
+                       &iev_lde->ev_read);
        iev_lde->handler_write = ldp_write_handler;
 
        imsg_init(&iev_lde_sync->ibuf, pipe_parent2lde_sync[0]);
        iev_lde_sync->handler_read = main_dispatch_lde;
-       iev_lde_sync->ev_read = thread_add_read(master,
-                                               iev_lde_sync->handler_read,
-                                               iev_lde_sync,
-                                               iev_lde_sync->ibuf.fd, NULL);
+       iev_lde_sync->ev_read = NULL;
+       thread_add_read(master, iev_lde_sync->handler_read, iev_lde_sync, iev_lde_sync->ibuf.fd,
+                       &iev_lde_sync->ev_read);
        iev_lde_sync->handler_write = ldp_write_handler;
 
        if (main_imsg_send_ipc_sockets(&iev_ldpe->ibuf, &iev_lde->ibuf))
index 9f87e58c40c90cb3ec5b754dc19788b6c0d94341..ce2441ca2f26001086b18ad3410dfcbe20185f71 100644 (file)
@@ -119,8 +119,9 @@ ldpe(void)
                fatal(NULL);
        imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC);
        iev_main->handler_read = ldpe_dispatch_main;
-       iev_main->ev_read = thread_add_read(master, iev_main->handler_read,
-                                           iev_main, iev_main->ibuf.fd, NULL);
+       iev_main->ev_read = NULL;
+       thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd,
+                       &iev_main->ev_read);
        iev_main->handler_write = ldp_write_handler;
 
        if ((iev_main_sync = calloc(1, sizeof(struct imsgev))) == NULL)
@@ -164,9 +165,11 @@ ldpe_init(struct ldpd_init *init)
                fatal("inet_pton");
 #ifdef __OpenBSD__
        global.pfkeysock = pfkey_init();
-       if (sysdep.no_pfkey == 0)
-               pfkey_ev = thread_add_read(master, ldpe_dispatch_pfkey, NULL,
-                                          global.pfkeysock, NULL);
+       if (sysdep.no_pfkey == 0) {
+               pfkey_ev = NULL;
+               thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock,
+                               &pfkey_ev);
+       }
 #endif
 
        /* mark sockets as closed */
@@ -353,11 +356,9 @@ ldpe_dispatch_main(struct thread *thread)
                                fatal(NULL);
                        imsg_init(&iev_lde->ibuf, fd);
                        iev_lde->handler_read = ldpe_dispatch_lde;
-                       iev_lde->ev_read = thread_add_read(master,
-                                                          iev_lde->handler_read,
-                                                          iev_lde,
-                                                          iev_lde->ibuf.fd,
-                                                          NULL);
+                       iev_lde->ev_read = NULL;
+                       thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd,
+                                       &iev_lde->ev_read);
                        iev_lde->handler_write = ldp_write_handler;
                        iev_lde->ev_write = NULL;
                        break;
@@ -697,8 +698,9 @@ ldpe_dispatch_pfkey(struct thread *thread)
 {
        int      fd = THREAD_FD(thread);
 
-       pfkey_ev = thread_add_read(master, ldpe_dispatch_pfkey, NULL,
-                                  global.pfkeysock, NULL);
+       pfkey_ev = NULL;
+       thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock,
+                       &pfkey_ev);
 
        if (pfkey_read(fd, NULL) == -1)
                fatal("pfkey_read failed, exiting...");
@@ -717,16 +719,15 @@ ldpe_setup_sockets(int af, int disc_socket, int edisc_socket,
 
        /* discovery socket */
        af_global->ldp_disc_socket = disc_socket;
-       af_global->disc_ev = thread_add_read(master, disc_recv_packet,
-                                            &af_global->disc_ev,
-                                            af_global->ldp_disc_socket, NULL);
+       af_global->disc_ev = NULL;
+       thread_add_read(master, disc_recv_packet, &af_global->disc_ev, af_global->ldp_disc_socket,
+                       &af_global->disc_ev);
 
        /* extended discovery socket */
        af_global->ldp_edisc_socket = edisc_socket;
-       af_global->edisc_ev = thread_add_read(master, disc_recv_packet,
-                                             &af_global->edisc_ev,
-                                             af_global->ldp_edisc_socket,
-                                             NULL);
+       af_global->edisc_ev = NULL;
+       thread_add_read(master, disc_recv_packet, &af_global->edisc_ev, af_global->ldp_edisc_socket,
+                       &af_global->edisc_ev);
 
        /* session socket */
        af_global->ldp_session_socket = session_socket;
index 2eb46733ee42cebaf249b2db2030c1b45071eb51..f867db228d524cffdf015d357284f69f3e9df7dc 100644 (file)
@@ -408,8 +408,8 @@ nbr_start_ktimer(struct nbr *nbr)
        /* send three keepalives per period */
        secs = nbr->keepalive / KEEPALIVE_PER_PERIOD;
        THREAD_TIMER_OFF(nbr->keepalive_timer);
-       nbr->keepalive_timer = thread_add_timer(master, nbr_ktimer, nbr, secs,
-                                               NULL);
+       nbr->keepalive_timer = NULL;
+       thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
 }
 
 void
@@ -438,8 +438,9 @@ static void
 nbr_start_ktimeout(struct nbr *nbr)
 {
        THREAD_TIMER_OFF(nbr->keepalive_timeout);
-       nbr->keepalive_timeout = thread_add_timer(master, nbr_ktimeout, nbr,
-                                                 nbr->keepalive, NULL);
+       nbr->keepalive_timeout = NULL;
+       thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
+                        &nbr->keepalive_timeout);
 }
 
 void
@@ -469,8 +470,8 @@ nbr_start_itimeout(struct nbr *nbr)
 
        secs = INIT_FSM_TIMEOUT;
        THREAD_TIMER_OFF(nbr->init_timeout);
-       nbr->init_timeout = thread_add_timer(master, nbr_itimeout, nbr, secs,
-                                            NULL);
+       nbr->init_timeout = NULL;
+       thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
 }
 
 void
@@ -518,8 +519,9 @@ nbr_start_idtimer(struct nbr *nbr)
        }
 
        THREAD_TIMER_OFF(nbr->initdelay_timer);
-       nbr->initdelay_timer = thread_add_timer(master, nbr_idtimer, nbr,
-                                               secs, NULL);
+       nbr->initdelay_timer = NULL;
+       thread_add_timer(master, nbr_idtimer, nbr, secs,
+                        &nbr->initdelay_timer);
 }
 
 void
index 73703503f317c27dfea6a9c142d9a1064f6d8cf6..be7f2ba649c6c013863693aae509b38eaf18775b 100644 (file)
@@ -143,8 +143,8 @@ disc_recv_packet(struct thread *thread)
        struct in_addr           lsr_id;
 
        /* reschedule read */
-       *threadp = thread_add_read(master, disc_recv_packet, threadp, fd,
-                                  NULL);
+       *threadp = NULL;
+       thread_add_read(master, disc_recv_packet, threadp, fd, &*threadp);
 
        /* setup buffer */
        memset(&m, 0, sizeof(m));
@@ -428,7 +428,8 @@ session_read(struct thread *thread)
        uint16_t         pdu_len, msg_len, msg_size, max_pdu_len;
        int              ret;
 
-       tcp->rev = thread_add_read(master, session_read, nbr, fd, NULL);
+       tcp->rev = NULL;
+       thread_add_read(master, session_read, nbr, fd, &tcp->rev);
 
        if ((n = read(fd, tcp->rbuf->buf + tcp->rbuf->wpos,
            sizeof(tcp->rbuf->buf) - tcp->rbuf->wpos)) == -1) {
@@ -732,8 +733,8 @@ tcp_new(int fd, struct nbr *nbr)
                if ((tcp->rbuf = calloc(1, sizeof(struct ibuf_read))) == NULL)
                        fatal(__func__);
 
-               tcp->rev = thread_add_read(master, session_read, nbr, tcp->fd,
-                                          NULL);
+               tcp->rev = NULL;
+               thread_add_read(master, session_read, nbr, tcp->fd, &tcp->rev);
                tcp->nbr = nbr;
        }
 
@@ -779,9 +780,9 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr)
        pconn->af = af;
        pconn->addr = *addr;
        TAILQ_INSERT_TAIL(&global.pending_conns, pconn, entry);
-       pconn->ev_timeout = thread_add_timer(master, pending_conn_timeout,
-                                            pconn, PENDING_CONN_TIMEOUT,
-                                            NULL);
+       pconn->ev_timeout = NULL;
+       thread_add_timer(master, pending_conn_timeout, pconn, PENDING_CONN_TIMEOUT,
+                        &pconn->ev_timeout);
 
        return (pconn);
 }
index f7b124f25b04d9952285c006a46ca456c316cf7e..eb354b67812855d9751fc288238b7400a4a88cef 100644 (file)
@@ -85,9 +85,11 @@ agentx_events_update(void)
   FD_ZERO (&fds);
   snmp_select_info (&maxfd, &fds, &timeout, &block);
 
-  if (!block)
-    timeout_thr = thread_add_timer_tv(agentx_tm, agentx_timeout, NULL,
-                                      &timeout, NULL);
+  if (!block) {
+    timeout_thr = NULL;
+    thread_add_timer_tv(agentx_tm, agentx_timeout, NULL, &timeout,
+                        &timeout_thr);
+  }
 
   ln = listhead (events);
   thr = ln ? listgetdata (ln) : NULL;
@@ -115,7 +117,8 @@ agentx_events_update(void)
       else if (FD_ISSET (fd, &fds))
         {
           struct listnode *newln;
-          thr = thread_add_read(agentx_tm, agentx_read, NULL, fd, NULL);
+          thr = NULL;
+          thread_add_read(agentx_tm, agentx_read, NULL, fd, &thr);
           newln = listnode_add_before (events, ln, thr);
           thr->arg = newln;
         }
index 7eda2bcddecce920d72bbfb9263ea3b7d1f9e1d0..a34fd4946e1b8efd4e1df5ddcc2eb49aaba21b1f 100644 (file)
@@ -132,8 +132,9 @@ quagga_signal_timer (struct thread *t)
   int i;
 
   sigm = THREAD_ARG (t);
-  sigm->t = thread_add_timer(sigm->t->master, quagga_signal_timer, &sigmaster,
-                             QUAGGA_SIGNAL_TIMER_INTERVAL, NULL);
+  sigm->t = NULL;
+  thread_add_timer(sigm->t->master, quagga_signal_timer, &sigmaster, QUAGGA_SIGNAL_TIMER_INTERVAL,
+                   &sigm->t);
   return quagga_sigevent_process ();
 }
 #endif /* SIGEVENT_SCHEDULE_THREAD */
@@ -378,8 +379,8 @@ signal_init (struct thread_master *m, int sigc,
   sigmaster.signals = signals;
 
 #ifdef SIGEVENT_SCHEDULE_THREAD  
-  sigmaster.t = 
-    thread_add_timer(m, quagga_signal_timer, &sigmaster,
-                     QUAGGA_SIGNAL_TIMER_INTERVAL, NULL);
+  sigmaster.t = NULL;
+  thread_add_timer(m, quagga_signal_timer, &sigmaster, QUAGGA_SIGNAL_TIMER_INTERVAL,
+                   &sigmaster.t);
 #endif /* SIGEVENT_SCHEDULE_THREAD */
 }
index e0db87e4b037c0df5f876a185b60131463b6e182..6e53061d45e41d35420309fd21b0295c07838147 100644 (file)
@@ -1197,16 +1197,18 @@ smux_event (enum smux_event event, int sock)
   switch (event)
     {
     case SMUX_SCHEDULE:
-      smux_connect_thread = thread_add_event(smux_master, smux_connect, NULL,
-                                             0, NULL);
+      smux_connect_thread = NULL;
+      thread_add_event(smux_master, smux_connect, NULL, 0,
+                       &smux_connect_thread);
       break;
     case SMUX_CONNECT:
-      smux_connect_thread = thread_add_timer(smux_master, smux_connect, NULL,
-                                             10, NULL);
+      smux_connect_thread = NULL;
+      thread_add_timer(smux_master, smux_connect, NULL, 10,
+                       &smux_connect_thread);
       break;
     case SMUX_READ:
-      smux_read_thread = thread_add_read(smux_master, smux_read, NULL, sock,
-                                         NULL);
+      smux_read_thread = NULL;
+      thread_add_read(smux_master, smux_read, NULL, sock, &smux_read_thread);
       break;
     default:
       break;
index a68c5d0bc26d359874a66b2618eb99f23f5256c4..a8e54a57de48f1a1b3d46d19b9f6808cdcaa8eb5 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2618,35 +2618,37 @@ vty_event (enum event event, int sock, struct vty *vty)
   switch (event)
     {
     case VTY_SERV:
-      vty_serv_thread = thread_add_read(vty_master, vty_accept, vty, sock,
-                                        NULL);
+      vty_serv_thread = NULL;
+      thread_add_read(vty_master, vty_accept, vty, sock, &vty_serv_thread);
       vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
       break;
 #ifdef VTYSH
     case VTYSH_SERV:
-      vty_serv_thread = thread_add_read(vty_master, vtysh_accept, vty, sock,
-                                        NULL);
+      vty_serv_thread = NULL;
+      thread_add_read(vty_master, vtysh_accept, vty, sock, &vty_serv_thread);
       vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
       break;
     case VTYSH_READ:
-      vty->t_read = thread_add_read(vty_master, vtysh_read, vty, sock, NULL);
+      vty->t_read = NULL;
+      thread_add_read(vty_master, vtysh_read, vty, sock, &vty->t_read);
       break;
     case VTYSH_WRITE:
-      vty->t_write = thread_add_write(vty_master, vtysh_write, vty, sock,
-                                      NULL);
+      vty->t_write = NULL;
+      thread_add_write(vty_master, vtysh_write, vty, sock, &vty->t_write);
       break;
 #endif /* VTYSH */
     case VTY_READ:
-      vty->t_read = thread_add_read(vty_master, vty_read, vty, sock, NULL);
+      vty->t_read = NULL;
+      thread_add_read(vty_master, vty_read, vty, sock, &vty->t_read);
 
       /* Time out treatment. */
       if (vty->v_timeout)
         {
           if (vty->t_timeout)
             thread_cancel (vty->t_timeout);
-          vty->t_timeout =
-            thread_add_timer(vty_master, vty_timeout, vty, vty->v_timeout,
-                             NULL);
+          vty->t_timeout = NULL;
+          thread_add_timer(vty_master, vty_timeout, vty, vty->v_timeout,
+                           &vty->t_timeout);
         }
       break;
     case VTY_WRITE:
@@ -2660,9 +2662,9 @@ vty_event (enum event event, int sock, struct vty *vty)
         }
       if (vty->v_timeout)
         {
-          vty->t_timeout =
-            thread_add_timer(vty_master, vty_timeout, vty, vty->v_timeout,
-                             NULL);
+          vty->t_timeout = NULL;
+          thread_add_timer(vty_master, vty_timeout, vty, vty->v_timeout,
+                           &vty->t_timeout);
         }
       break;
     }
index 3d481aa89916d453e2b22fa74fc34fea29adf661..e997e61b324e8cf8b688c1097767c847df6c2a17 100644 (file)
@@ -126,8 +126,9 @@ work_queue_schedule (struct work_queue *wq, unsigned int delay)
        && (wq->thread == NULL)
        && (listcount (wq->items) > 0) )
     {
-      wq->thread = thread_add_background(wq->master, work_queue_run, wq,
-                                         delay, NULL);
+      wq->thread = NULL;
+      thread_add_background(wq->master, work_queue_run, wq, delay,
+                            &wq->thread);
       /* set thread yield time, if needed */
       if (wq->thread && wq->spec.yield != THREAD_YIELD_TIME_SLOT)
         thread_set_yield_time (wq->thread, wq->spec.yield);
index 60e35c66fab70545789427921ad97a4cccbea451..1d3c93d85d193d4126375492c75d714613853c6e 100644 (file)
@@ -310,8 +310,9 @@ zclient_flush_data(struct thread *thread)
       return zclient_failed(zclient);
       break;
     case BUFFER_PENDING:
-      zclient->t_write = thread_add_write(zclient->master, zclient_flush_data,
-                                          zclient, zclient->sock, NULL);
+      zclient->t_write = NULL;
+      thread_add_write(zclient->master, zclient_flush_data, zclient, zclient->sock,
+                       &zclient->t_write);
       break;
     case BUFFER_EMPTY:
       break;
@@ -2023,9 +2024,9 @@ zclient_event (enum event event, struct zclient *zclient)
                        zclient->fail < 3 ? 10 : 60, &zclient->t_connect);
       break;
     case ZCLIENT_READ:
-      zclient->t_read = 
-       thread_add_read(zclient->master, zclient_read, zclient, zclient->sock,
-                        NULL);
+      zclient->t_read = NULL;
+      thread_add_read(zclient->master, zclient_read, zclient, zclient->sock,
+                      &zclient->t_read);
       break;
     }
 }
index 3cbeb759d992f2b6a10ad3a57bec3d8dcba17ce4..eb51e353c54767464871395a679f7ad33cab6c70 100644 (file)
@@ -112,8 +112,9 @@ ospf6_lsa_originate (struct ospf6_lsa *lsa)
   lsdb_self = ospf6_get_scoped_lsdb_self (lsa);
   ospf6_lsdb_add (ospf6_lsa_copy (lsa), lsdb_self);
 
-  lsa->refresh = thread_add_timer(master, ospf6_lsa_refresh, lsa,
-                                  OSPF_LS_REFRESH_TIME, NULL);
+  lsa->refresh = NULL;
+  thread_add_timer(master, ospf6_lsa_refresh, lsa, OSPF_LS_REFRESH_TIME,
+                   &lsa->refresh);
 
   if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) ||
       IS_OSPF6_DEBUG_ORIGINATE_TYPE (lsa->header->type))
@@ -225,10 +226,11 @@ ospf6_install_lsa (struct ospf6_lsa *lsa)
     }
 
   monotime(&now);
-  if (! OSPF6_LSA_IS_MAXAGE (lsa))
-    lsa->expire = thread_add_timer(master, ospf6_lsa_expire, lsa,
-                                   OSPF_LSA_MAXAGE + lsa->birth.tv_sec - now.tv_sec,
-                                   NULL);
+  if (! OSPF6_LSA_IS_MAXAGE (lsa)) {
+    lsa->expire = NULL;
+    thread_add_timer(master, ospf6_lsa_expire, lsa, OSPF_LSA_MAXAGE + lsa->birth.tv_sec - now.tv_sec,
+                     &lsa->expire);
+  }
   else
     lsa->expire = NULL;
 
@@ -362,10 +364,8 @@ ospf6_flood_interface (struct ospf6_neighbor *from,
         zlog_debug ("Add retrans-list of this neighbor");
       ospf6_increment_retrans_count (lsa);
       ospf6_lsdb_add (ospf6_lsa_copy (lsa), on->retrans_list);
-      if (on->thread_send_lsupdate == NULL)
-        on->thread_send_lsupdate =
-          thread_add_timer(master, ospf6_lsupdate_send_neighbor, on,
-                           on->ospf6_if->rxmt_interval, NULL);
+      thread_add_timer(master, ospf6_lsupdate_send_neighbor, on, on->ospf6_if->rxmt_interval,
+                       &on->thread_send_lsupdate);
       retrans_added++;
     }
 
@@ -407,9 +407,8 @@ ospf6_flood_interface (struct ospf6_neighbor *from,
       (oi->type == OSPF_IFTYPE_POINTOPOINT))
     {
       ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsupdate_list);
-      if (oi->thread_send_lsupdate == NULL)
-        oi->thread_send_lsupdate =
-          thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0, NULL);
+      thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0,
+                       &oi->thread_send_lsupdate);
     }
   else
     {
@@ -417,9 +416,9 @@ ospf6_flood_interface (struct ospf6_neighbor *from,
       for (ALL_LIST_ELEMENTS (oi->neighbor_list, node, nnode, on))
         {
           THREAD_OFF (on->thread_send_lsupdate);
-          on->thread_send_lsupdate =
-            thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0,
-                             NULL);
+          on->thread_send_lsupdate = NULL;
+          thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0,
+                           &on->thread_send_lsupdate);
         }
     }
 }
@@ -579,10 +578,8 @@ ospf6_acknowledge_lsa_bdrouter (struct ospf6_lsa *lsa, int ismore_recent,
             zlog_debug ("Delayed acknowledgement (BDR & MoreRecent & from DR)");
           /* Delayed acknowledgement */
           ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list);
-          if (oi->thread_send_lsack == NULL)
-            oi->thread_send_lsack =
-              thread_add_timer(master, ospf6_lsack_send_interface, oi, 3,
-                               NULL);
+          thread_add_timer(master, ospf6_lsack_send_interface, oi, 3,
+                           &oi->thread_send_lsack);
         }
       else
         {
@@ -604,10 +601,8 @@ ospf6_acknowledge_lsa_bdrouter (struct ospf6_lsa *lsa, int ismore_recent,
             zlog_debug ("Delayed acknowledgement (BDR & Duplicate & ImpliedAck & from DR)");
           /* Delayed acknowledgement */
           ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list);
-          if (oi->thread_send_lsack == NULL)
-            oi->thread_send_lsack =
-              thread_add_timer(master, ospf6_lsack_send_interface, oi, 3,
-                               NULL);
+          thread_add_timer(master, ospf6_lsack_send_interface, oi, 3,
+                           &oi->thread_send_lsack);
         }
       else
         {
@@ -625,9 +620,8 @@ ospf6_acknowledge_lsa_bdrouter (struct ospf6_lsa *lsa, int ismore_recent,
       if (is_debug)
         zlog_debug ("Direct acknowledgement (BDR & Duplicate)");
       ospf6_lsdb_add (ospf6_lsa_copy (lsa), from->lsack_list);
-      if (from->thread_send_lsack == NULL)
-        from->thread_send_lsack =
-          thread_add_event(master, ospf6_lsack_send_neighbor, from, 0, NULL);
+      thread_add_event(master, ospf6_lsack_send_neighbor, from, 0,
+                       &from->thread_send_lsack);
       return;
     }
 
@@ -669,9 +663,8 @@ ospf6_acknowledge_lsa_allother (struct ospf6_lsa *lsa, int ismore_recent,
         zlog_debug ("Delayed acknowledgement (AllOther & MoreRecent)");
       /* Delayed acknowledgement */
       ospf6_lsdb_add (ospf6_lsa_copy (lsa), oi->lsack_list);
-      if (oi->thread_send_lsack == NULL)
-        oi->thread_send_lsack =
-          thread_add_timer(master, ospf6_lsack_send_interface, oi, 3, NULL);
+      thread_add_timer(master, ospf6_lsack_send_interface, oi, 3,
+                       &oi->thread_send_lsack);
       return;
     }
 
@@ -693,9 +686,8 @@ ospf6_acknowledge_lsa_allother (struct ospf6_lsa *lsa, int ismore_recent,
       if (is_debug)
         zlog_debug ("Direct acknowledgement (AllOther & Duplicate)");
       ospf6_lsdb_add (ospf6_lsa_copy (lsa), from->lsack_list);
-      if (from->thread_send_lsack == NULL)
-        from->thread_send_lsack =
-          thread_add_event(master, ospf6_lsack_send_neighbor, from, 0, NULL);
+      thread_add_event(master, ospf6_lsack_send_neighbor, from, 0,
+                       &from->thread_send_lsack);
       return;
     }
 
@@ -832,9 +824,8 @@ ospf6_receive_lsa (struct ospf6_neighbor *from,
 
       /* a) Acknowledge back to neighbor (Direct acknowledgement, 13.5) */
       ospf6_lsdb_add (ospf6_lsa_copy (new), from->lsack_list);
-      if (from->thread_send_lsack == NULL)
-        from->thread_send_lsack =
-          thread_add_event(master, ospf6_lsack_send_neighbor, from, 0, NULL);
+      thread_add_event(master, ospf6_lsack_send_neighbor, from, 0,
+                       &from->thread_send_lsack);
 
       /* b) Discard */
       ospf6_lsa_delete (new);
@@ -916,8 +907,8 @@ ospf6_receive_lsa (struct ospf6_neighbor *from,
               zlog_debug ("Newer instance of the self-originated LSA");
               zlog_debug ("Schedule reorigination");
             }
-          new->refresh = thread_add_event(master, ospf6_lsa_refresh, new, 0,
-                                          NULL);
+          new->refresh = NULL;
+          thread_add_event(master, ospf6_lsa_refresh, new, 0, &new->refresh);
         }
 
       return;
@@ -1003,10 +994,8 @@ ospf6_receive_lsa (struct ospf6_neighbor *from,
           /* XXX, MinLSArrival check !? RFC 2328 13 (8) */
 
           ospf6_lsdb_add (ospf6_lsa_copy (old), from->lsupdate_list);
-          if (from->thread_send_lsupdate == NULL)
-            from->thread_send_lsupdate =
-              thread_add_event(master, ospf6_lsupdate_send_neighbor, from, 0,
-                               NULL);
+          thread_add_event(master, ospf6_lsupdate_send_neighbor, from, 0,
+                           &from->thread_send_lsupdate);
          ospf6_lsa_delete (new);
          return;
         }
index d75b1098fa4c48ef488b8b2789fea79a5aee4907..758688c60153ec36a7687cd1312e18003e578426 100644 (file)
@@ -752,9 +752,10 @@ interface_up (struct thread *thread)
 
   /* Schedule Hello */
   if (! CHECK_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE) &&
-      !if_is_loopback (oi->interface))
-    oi->thread_send_hello = thread_add_event(master, ospf6_hello_send, oi, 0,
-                                             NULL);
+      !if_is_loopback (oi->interface)) {
+    oi->thread_send_hello = NULL;
+    thread_add_event(master, ospf6_hello_send, oi, 0, &oi->thread_send_hello);
+  }
 
   /* decide next interface state */
   if ((if_is_pointopoint (oi->interface)) ||
@@ -1517,8 +1518,8 @@ DEFUN (no_ipv6_ospf6_passive,
 
   UNSET_FLAG (oi->flag, OSPF6_INTERFACE_PASSIVE);
   THREAD_OFF (oi->thread_send_hello);
-  oi->thread_send_hello =
-    thread_add_event(master, ospf6_hello_send, oi, 0, NULL);
+  oi->thread_send_hello = NULL;
+  thread_add_event(master, ospf6_hello_send, oi, 0, &oi->thread_send_hello);
 
   return CMD_SUCCESS;
 }
index 3ae368f1d036e1bf737c7d6963ea6522bc87b864..a993869a91af4d370a5514ca775692b586133c53 100644 (file)
@@ -722,8 +722,9 @@ ospf6_lsa_refresh (struct thread *thread)
 
   new = ospf6_lsa_create (self->header);
   new->lsdb = old->lsdb;
-  new->refresh = thread_add_timer(master, ospf6_lsa_refresh, new,
-                                  OSPF_LS_REFRESH_TIME, NULL);
+  new->refresh = NULL;
+  thread_add_timer(master, ospf6_lsa_refresh, new, OSPF_LS_REFRESH_TIME,
+                   &new->refresh);
 
   /* store it in the LSDB for self-originated LSAs */
   ospf6_lsdb_add (ospf6_lsa_copy (new), lsdb_self);
index 7ad3736d2a07a7ad95a1eb9d28c890e3f34becbf..6746b8104f3e0eed1895129e8d4f7e15253fe116 100644 (file)
@@ -558,9 +558,11 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
   if (! CHECK_FLAG (dbdesc->bits, OSPF6_DBDESC_MBIT) &&
       ! CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT))
     thread_add_event (master, exchange_done, on, 0, NULL);
-  else
-    on->thread_send_dbdesc =
-      thread_add_event (master, ospf6_dbdesc_send_newone, on, 0, NULL);
+  else {
+    on->thread_send_dbdesc = NULL;
+    thread_add_event(master, ospf6_dbdesc_send_newone, on, 0,
+                     &on->thread_send_dbdesc);
+  }
 
   /* save last received dbdesc */
   memcpy (&on->dbdesc_last, dbdesc, sizeof (struct ospf6_dbdesc));
@@ -636,8 +638,9 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
           if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
             zlog_debug ("Duplicated dbdesc causes retransmit");
           THREAD_OFF (on->thread_send_dbdesc);
-          on->thread_send_dbdesc =
-            thread_add_event (master, ospf6_dbdesc_send, on, 0, NULL);
+          on->thread_send_dbdesc = NULL;
+          thread_add_event(master, ospf6_dbdesc_send, on, 0,
+                           &on->thread_send_dbdesc);
           return;
         }
 
@@ -1971,9 +1974,9 @@ ospf6_lsreq_send (struct thread *thread)
   /* set next thread */
   if (on->request_list->count != 0)
     {
-      on->thread_send_lsreq =
-         thread_add_timer (master, ospf6_lsreq_send, on,
-                           on->ospf6_if->rxmt_interval, NULL);
+      on->thread_send_lsreq = NULL;
+      thread_add_timer(master, ospf6_lsreq_send, on, on->ospf6_if->rxmt_interval,
+                       &on->thread_send_lsreq);
     }
 
   return 0;
@@ -2090,13 +2093,16 @@ ospf6_lsupdate_send_neighbor (struct thread *thread)
                    on->ospf6_if, oh);
     }
 
-  if (on->lsupdate_list->count != 0)
-    on->thread_send_lsupdate =
-      thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0, NULL);
-  else if (on->retrans_list->count != 0)
-    on->thread_send_lsupdate =
-      thread_add_timer (master, ospf6_lsupdate_send_neighbor, on,
-                       on->ospf6_if->rxmt_interval, NULL);
+  if (on->lsupdate_list->count != 0) {
+    on->thread_send_lsupdate = NULL;
+    thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0,
+                     &on->thread_send_lsupdate);
+  }
+  else if (on->retrans_list->count != 0) {
+    on->thread_send_lsupdate = NULL;
+    thread_add_timer(master, ospf6_lsupdate_send_neighbor, on, on->ospf6_if->rxmt_interval,
+                     &on->thread_send_lsupdate);
+  }
   return 0;
 }
 
@@ -2171,8 +2177,9 @@ ospf6_lsupdate_send_interface (struct thread *thread)
 
   if (oi->lsupdate_list->count > 0)
     {
-      oi->thread_send_lsupdate =
-        thread_add_event (master, ospf6_lsupdate_send_interface, oi, 0, NULL);
+      oi->thread_send_lsupdate = NULL;
+      thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0,
+                       &oi->thread_send_lsupdate);
     }
 
   return 0;
index 35ac40fc852707f4401bf597e41cf5e5446cad39..09d3a523a32da8cdefc0ce88f4ade20a7cb2fe6f 100644 (file)
@@ -238,8 +238,9 @@ hello_received (struct thread *thread)
 
   /* reset Inactivity Timer */
   THREAD_OFF (on->inactivity_timer);
-  on->inactivity_timer = thread_add_timer(master, inactivity_timer, on,
-                                          on->ospf6_if->dead_interval, NULL);
+  on->inactivity_timer = NULL;
+  thread_add_timer(master, inactivity_timer, on, on->ospf6_if->dead_interval,
+                   &on->inactivity_timer);
 
   if (on->state <= OSPF6_NEIGHBOR_DOWN)
     ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on,
@@ -278,8 +279,8 @@ twoway_received (struct thread *thread)
   SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
 
   THREAD_OFF (on->thread_send_dbdesc);
-  on->thread_send_dbdesc =
-    thread_add_event(master, ospf6_dbdesc_send, on, 0, NULL);
+  on->thread_send_dbdesc = NULL;
+  thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc);
 
   return 0;
 }
@@ -410,8 +411,9 @@ ospf6_check_nbr_loading (struct ospf6_neighbor *on)
        {
          if (on->thread_send_lsreq != NULL)
            THREAD_OFF (on->thread_send_lsreq);
-         on->thread_send_lsreq =
-           thread_add_event(master, ospf6_lsreq_send, on, 0, NULL);
+         on->thread_send_lsreq = NULL;
+         thread_add_event(master, ospf6_lsreq_send, on, 0,
+                           &on->thread_send_lsreq);
        }
     }
 }
@@ -459,8 +461,9 @@ adj_ok (struct thread *thread)
       SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
 
       THREAD_OFF (on->thread_send_dbdesc);
-      on->thread_send_dbdesc =
-        thread_add_event(master, ospf6_dbdesc_send, on, 0, NULL);
+      on->thread_send_dbdesc = NULL;
+      thread_add_event(master, ospf6_dbdesc_send, on, 0,
+                       &on->thread_send_dbdesc);
 
     }
   else if (on->state >= OSPF6_NEIGHBOR_EXSTART &&
@@ -514,8 +517,8 @@ seqnumber_mismatch (struct thread *thread)
   THREAD_OFF (on->thread_send_dbdesc);
   on->dbdesc_seqnum++;         /* Incr seqnum as per RFC2328, sec 10.3 */
 
-  on->thread_send_dbdesc =
-    thread_add_event(master, ospf6_dbdesc_send, on, 0, NULL);
+  on->thread_send_dbdesc = NULL;
+  thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc);
 
   return 0;
 }
@@ -553,8 +556,8 @@ bad_lsreq (struct thread *thread)
   THREAD_OFF (on->thread_send_dbdesc);
   on->dbdesc_seqnum++;         /* Incr seqnum as per RFC2328, sec 10.3 */
 
-  on->thread_send_dbdesc =
-    thread_add_event(master, ospf6_dbdesc_send, on, 0, NULL);
+  on->thread_send_dbdesc = NULL;
+  thread_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc);
 
   return 0;
 }
index 25a4226665b3708162fc089d0a2aa45cc2a8976a..6a10ba7ad5b871f2ae6de08351c6d40100e0869d 100644 (file)
@@ -727,9 +727,9 @@ ospf6_spf_schedule (struct ospf6 *ospf6, unsigned int reason)
 
   zlog_info ("SPF: Scheduled in %ld msec", delay);
 
-  ospf6->t_spf_calc =
-    thread_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, delay,
-                          NULL);
+  ospf6->t_spf_calc = NULL;
+  thread_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, delay,
+                        &ospf6->t_spf_calc);
 }
 
 void
index fbb3316ba3f23a3b1557dcfa1bb7f7e196416411..85f7e0ce3a34bf5e4514b1c5430b8092efc49718 100644 (file)
@@ -286,10 +286,9 @@ ospf6_maxage_remover (struct thread *thread)
 void
 ospf6_maxage_remove (struct ospf6 *o)
 {
-  if (o && ! o->maxage_remover)
-    o->maxage_remover = thread_add_timer(master, ospf6_maxage_remover, o,
-                                         OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT,
-                                         NULL);
+  if (o)
+    thread_add_timer(master, ospf6_maxage_remover, o, OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT,
+                     &o->maxage_remover);
 }
 
 /* start ospf6 */
index 5c514e18f817de04e9b40099fbe07831d244231f..633b22346da0c62e25dc0fad8cb506c274a27833 100644 (file)
@@ -304,30 +304,24 @@ ospf_apiserver_event (enum event event, int fd,
       (void) thread_add_read(master, ospf_apiserver_accept, apiserv, fd, NULL);
       break;
     case OSPF_APISERVER_SYNC_READ:
-      apiserv->t_sync_read =
-       thread_add_read(master, ospf_apiserver_read, apiserv, fd, NULL);
+      apiserv->t_sync_read = NULL;
+      thread_add_read(master, ospf_apiserver_read, apiserv, fd,
+                      &apiserv->t_sync_read);
       break;
 #ifdef USE_ASYNC_READ
     case OSPF_APISERVER_ASYNC_READ:
-      apiserv->t_async_read =
-       thread_add_read(master, ospf_apiserver_read, apiserv, fd, NULL);
+      apiserv->t_async_read = NULL;
+      thread_add_read(master, ospf_apiserver_read, apiserv, fd,
+                      &apiserv->t_async_read);
       break;
 #endif /* USE_ASYNC_READ */
     case OSPF_APISERVER_SYNC_WRITE:
-      if (!apiserv->t_sync_write)
-       {
-         apiserv->t_sync_write =
-           thread_add_write(master, ospf_apiserver_sync_write, apiserv, fd,
-                             NULL);
-       }
+      thread_add_write(master, ospf_apiserver_sync_write, apiserv, fd,
+                       &apiserv->t_sync_write);
       break;
     case OSPF_APISERVER_ASYNC_WRITE:
-      if (!apiserv->t_async_write)
-       {
-         apiserv->t_async_write =
-           thread_add_write(master, ospf_apiserver_async_write, apiserv, fd,
-                             NULL);
-       }
+      thread_add_write(master, ospf_apiserver_async_write, apiserv, fd,
+                       &apiserv->t_async_write);
       break;
     }
 }
index 570e15176408f9ad5e191347284df61bf3d13589..9067acb7f54eff1701ab1cd11fc97c67f714cc53 100644 (file)
@@ -3741,9 +3741,9 @@ ospf_lsa_refresh_walker (struct thread *t)
        }
     }
 
-  ospf->t_lsa_refresher = thread_add_timer(master, ospf_lsa_refresh_walker,
-                                           ospf, ospf->lsa_refresh_interval,
-                                           NULL);
+  ospf->t_lsa_refresher = NULL;
+  thread_add_timer(master, ospf_lsa_refresh_walker, ospf, ospf->lsa_refresh_interval,
+                   &ospf->t_lsa_refresher);
   ospf->lsa_refresher_started = monotime(NULL);
 
   for (ALL_LIST_ELEMENTS (lsa_to_refresh, node, nnode, lsa))
index 0c1830166f024bad8648c0ccc0ad72010303b50c..af22d0f29aa61f4fb9191b36b07c60ddeca22969 100644 (file)
@@ -1342,9 +1342,9 @@ ospf_opaque_lsa_originate_schedule (struct ospf_interface *oi, int *delay0)
     {
       if (IS_DEBUG_OSPF_EVENT)
         zlog_debug ("Schedule Type-9 Opaque-LSA origination in %d ms later.", delay);
-      oi->t_opaque_lsa_self =
-       thread_add_timer_msec(master, ospf_opaque_type9_lsa_originate, oi,
-                              delay, NULL);
+      oi->t_opaque_lsa_self = NULL;
+      thread_add_timer_msec(master, ospf_opaque_type9_lsa_originate, oi, delay,
+                            &oi->t_opaque_lsa_self);
       delay += top->min_ls_interval;
     }
 
@@ -1359,9 +1359,9 @@ ospf_opaque_lsa_originate_schedule (struct ospf_interface *oi, int *delay0)
        */
       if (IS_DEBUG_OSPF_EVENT)
         zlog_debug ("Schedule Type-10 Opaque-LSA origination in %d ms later.", delay);
-      area->t_opaque_lsa_self =
-        thread_add_timer_msec(master, ospf_opaque_type10_lsa_originate, area,
-                              delay, NULL);
+      area->t_opaque_lsa_self = NULL;
+      thread_add_timer_msec(master, ospf_opaque_type10_lsa_originate, area, delay,
+                            &area->t_opaque_lsa_self);
       delay += top->min_ls_interval;
     }
 
@@ -1376,9 +1376,9 @@ ospf_opaque_lsa_originate_schedule (struct ospf_interface *oi, int *delay0)
        */
       if (IS_DEBUG_OSPF_EVENT)
         zlog_debug ("Schedule Type-11 Opaque-LSA origination in %d ms later.", delay);
-      top->t_opaque_lsa_self =
-        thread_add_timer_msec(master, ospf_opaque_type11_lsa_originate, top,
-                              delay, NULL);
+      top->t_opaque_lsa_self = NULL;
+      thread_add_timer_msec(master, ospf_opaque_type11_lsa_originate, top, delay,
+                            &top->t_opaque_lsa_self);
       delay += top->min_ls_interval;
     }
 
index 6b5b0e4edd96672e5b45e7a0d67f8d06284144d1..8446ebcea718800e771143644312af400525a18f 100644 (file)
@@ -487,7 +487,8 @@ ospf_ls_req_event (struct ospf_neighbor *nbr)
       thread_cancel (nbr->t_ls_req);
       nbr->t_ls_req = NULL;
     }
-  nbr->t_ls_req = thread_add_event(master, ospf_ls_req_timer, nbr, 0, NULL);
+  nbr->t_ls_req = NULL;
+  thread_add_event(master, ospf_ls_req_timer, nbr, 0, &nbr->t_ls_req);
 }
 
 /* Cyclic timer function.  Fist registered in ospf_nbr_new () in
@@ -850,9 +851,10 @@ ospf_write (struct thread *thread)
        }
   
   /* If packets still remain in queue, call write thread. */
-  if (!list_isempty (ospf->oi_write_q))
-    ospf->t_write =                                              
-      thread_add_write(master, ospf_write, ospf, ospf->fd, NULL);
+  if (!list_isempty (ospf->oi_write_q)) {
+    ospf->t_write = NULL;
+    thread_add_write(master, ospf_write, ospf, ospf->fd, &ospf->t_write);
+  }
 
   return 0;
 }
@@ -2772,7 +2774,8 @@ ospf_read (struct thread *thread)
   ospf = THREAD_ARG (thread);
 
   /* prepare for next packet. */
-  ospf->t_read = thread_add_read(master, ospf_read, ospf, ospf->fd, NULL);
+  ospf->t_read = NULL;
+  thread_add_read(master, ospf_read, ospf, ospf->fd, &ospf->t_read);
 
   stream_reset(ospf->ibuf);
   if (!(ibuf = ospf_recv_packet (ospf->fd, &ifp, ospf->ibuf)))
@@ -3802,8 +3805,9 @@ ospf_ls_upd_send_queue_event (struct thread *thread)
       if (IS_DEBUG_OSPF_EVENT)
         zlog_debug ("ospf_ls_upd_send_queue: update lists not cleared,"
                    " %d nodes to try again, raising new event", again);
-      oi->t_ls_upd_event = 
-        thread_add_event(master, ospf_ls_upd_send_queue_event, oi, 0, NULL);
+      oi->t_ls_upd_event = NULL;
+      thread_add_event(master, ospf_ls_upd_send_queue_event, oi, 0,
+                       &oi->t_ls_upd_event);
     }
 
   if (IS_DEBUG_OSPF_EVENT)
index d54ebc8b43f268d89047e9d1ad7f668ac46c923c..3d8d7f8e037274d0f4a298484bd39483ec8a8d23 100644 (file)
@@ -1464,6 +1464,7 @@ ospf_spf_calculate_schedule (struct ospf *ospf, ospf_spf_reason_t reason)
 
   zlog_info ("SPF: Scheduled in %ld msec", delay);
 
-  ospf->t_spf_calc =
-    thread_add_timer_msec(master, ospf_spf_calculate_timer, ospf, delay, NULL);
+  ospf->t_spf_calc = NULL;
+  thread_add_timer_msec(master, ospf_spf_calculate_timer, ospf, delay,
+                        &ospf->t_spf_calc);
 }
index 314c9e72b437025a319a353ece6aedbee7162600..c22793a0986517af4404609dcf4e5e4fbea73992 100644 (file)
@@ -1278,9 +1278,9 @@ ospf_distribute_list_update (struct ospf *ospf, uintptr_t type,
     return;
 
   /* Set timer. */
-  ospf->t_distribute_update =
-    thread_add_timer_msec(master, ospf_distribute_list_update_timer,
-                          (void *)type, ospf->min_ls_interval, NULL);
+  ospf->t_distribute_update = NULL;
+  thread_add_timer_msec(master, ospf_distribute_list_update_timer, (void *)type, ospf->min_ls_interval,
+                        &ospf->t_distribute_update);
 }
 
 /* If access-list is updated, apply some check. */
index 40f35c6d33bb63fb844c5bbdd10f892998747541..0c3230d3676f8e2887de9eff61f49fbe1aa7bc87 100644 (file)
@@ -264,18 +264,18 @@ ospf_new (u_short instance)
   /* MaxAge init. */
   new->maxage_delay = OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT;
   new->maxage_lsa = route_table_init();
-  new->t_maxage_walker =
-    thread_add_timer(master, ospf_lsa_maxage_walker, new,
-                     OSPF_LSA_MAXAGE_CHECK_INTERVAL, NULL);
+  new->t_maxage_walker = NULL;
+  thread_add_timer(master, ospf_lsa_maxage_walker, new, OSPF_LSA_MAXAGE_CHECK_INTERVAL,
+                   &new->t_maxage_walker);
 
   /* Distance table init. */
   new->distance_table = route_table_init ();
 
   new->lsa_refresh_queue.index = 0;
   new->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT;
-  new->t_lsa_refresher = thread_add_timer(master, ospf_lsa_refresh_walker,
-                                          new, new->lsa_refresh_interval,
-                                          NULL);
+  new->t_lsa_refresher = NULL;
+  thread_add_timer(master, ospf_lsa_refresh_walker, new, new->lsa_refresh_interval,
+                   &new->t_lsa_refresher);
   new->lsa_refresher_started = monotime(NULL);
 
   if ((new->fd = ospf_sock_init()) < 0)
@@ -290,7 +290,8 @@ ospf_new (u_short instance)
               OSPF_MAX_PACKET_SIZE+1);
       exit(1);
     }
-  new->t_read = thread_add_read(master, ospf_read, new, new->fd, NULL);
+  new->t_read = NULL;
+  thread_add_read(master, ospf_read, new, new->fd, &new->t_read);
   new->oi_write_q = list_new ();
   new->write_oi_count = OSPF_WRITE_INTERFACE_COUNT_DEFAULT;
   
@@ -1594,9 +1595,8 @@ ospf_timers_refresh_set (struct ospf *ospf, int interval)
   if (time_left > interval)
     {
       OSPF_TIMER_OFF (ospf->t_lsa_refresher);
-      ospf->t_lsa_refresher =
-       thread_add_timer(master, ospf_lsa_refresh_walker, ospf, interval,
-                         NULL);
+      thread_add_timer(master, ospf_lsa_refresh_walker, ospf, interval,
+                       &ospf->t_lsa_refresher);
     }
   ospf->lsa_refresh_interval = interval;
 
@@ -1614,9 +1614,9 @@ ospf_timers_refresh_unset (struct ospf *ospf)
   if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
     {
       OSPF_TIMER_OFF (ospf->t_lsa_refresher);
-      ospf->t_lsa_refresher =
-       thread_add_timer(master, ospf_lsa_refresh_walker, ospf,
-                         OSPF_LSA_REFRESH_INTERVAL_DEFAULT, NULL);
+      ospf->t_lsa_refresher = NULL;
+      thread_add_timer(master, ospf_lsa_refresh_walker, ospf, OSPF_LSA_REFRESH_INTERVAL_DEFAULT,
+                       &ospf->t_lsa_refresher);
     }
 
   ospf->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT;
index b09dd635a06823cc8374e5f9fbfffe82a55ad622..8ceddfa39de290db1785ee94d1f50b5f0d53963a 100644 (file)
@@ -70,8 +70,9 @@ pim_msdp_sock_accept(struct thread *thread)
     zlog_err ("accept_sock is negative value %d", accept_sock);
     return -1;
   }
-  listener->thread = thread_add_read(master, pim_msdp_sock_accept, listener,
-                                     accept_sock, NULL);
+  listener->thread = NULL;
+  thread_add_read(master, pim_msdp_sock_accept, listener, accept_sock,
+                  &listener->thread);
 
   /* accept client connection. */
   msdp_sock = sockunion_accept(accept_sock, &su);
@@ -173,8 +174,9 @@ pim_msdp_sock_listen(void)
   /* add accept thread */
   listener->fd = sock;
   memcpy(&listener->su, &sin, socklen);
-  listener->thread = thread_add_read(msdp->master, pim_msdp_sock_accept,
-                                     listener, sock, NULL);
+  listener->thread = NULL;
+  thread_add_read(msdp->master, pim_msdp_sock_accept, listener, sock,
+                  &listener->thread);
 
   msdp->flags |= PIM_MSDPF_LISTENER;
   return 0;
index 01632182df916eac51118b19904fc7c83e617a39..16dbb3ef5639eec117b89722de57463f76436809 100644 (file)
@@ -88,9 +88,8 @@ static void zclient_lookup_sched(struct zclient *zlookup, int delay)
 static void zclient_lookup_sched_now(struct zclient *zlookup)
 {
   zassert(!zlookup->t_connect);
-
-  zlookup->t_connect = thread_add_event(master, zclient_lookup_connect,
-                                        zlookup, 0, NULL);
+  thread_add_event(master, zclient_lookup_connect, zlookup, 0,
+                   &zlookup->t_connect);
 
   zlog_notice("%s: zclient lookup immediate connection scheduled",
              __PRETTY_FUNCTION__);
index f907f43f4b1787792e7b29f229a42b0deb353c1f..2477740b9b62c27eaef25a750c0053a88ee2edca 100644 (file)
@@ -107,8 +107,9 @@ rip_peer_get (struct in_addr *addr)
     }
 
   /* Update timeout thread. */
-  peer->t_timeout = thread_add_timer(master, rip_peer_timeout, peer,
-                                     RIP_PEER_TIMER_DEFAULT, NULL);
+  peer->t_timeout = NULL;
+  thread_add_timer(master, rip_peer_timeout, peer, RIP_PEER_TIMER_DEFAULT,
+                   &peer->t_timeout);
 
   /* Last update time set. */
   time (&peer->uptime);
index 24bb48381e41923b2f860d691c5ce5d2a1f37e88..e9e83a1c7fa17628be7b97edf4fdee6594346e56 100644 (file)
@@ -2625,8 +2625,9 @@ rip_triggered_update (struct thread *t)
    update is triggered when the timer expires. */
   interval = (random () % 5) + 1;
 
-  rip->t_triggered_interval = 
-    thread_add_timer(master, rip_triggered_interval, NULL, interval, NULL);
+  rip->t_triggered_interval = NULL;
+  thread_add_timer(master, rip_triggered_interval, NULL, interval,
+                   &rip->t_triggered_interval);
 
   return 0;
 }
@@ -2781,18 +2782,18 @@ rip_event (enum rip_event event, int sock)
   switch (event)
     {
     case RIP_READ:
-      rip->t_read = thread_add_read(master, rip_read, NULL, sock, NULL);
+      rip->t_read = NULL;
+      thread_add_read(master, rip_read, NULL, sock, &rip->t_read);
       break;
     case RIP_UPDATE_EVENT:
       RIP_TIMER_OFF (rip->t_update);
       jitter = rip_update_jitter (rip->update_time);
-      rip->t_update = 
-       thread_add_timer(master, rip_update, NULL,
-                         sock ? 2 : rip->update_time + jitter, NULL);
+      thread_add_timer(master, rip_update, NULL, sock ? 2 : rip->update_time + jitter,
+                       &rip->t_update);
       break;
     case RIP_TRIGGERED_UPDATE:
       if (rip->t_triggered_interval)
-       rip->trigger = 1;
+        rip->trigger = 1;
       else thread_add_event(master, rip_triggered_update, NULL, 0,
                             &rip->t_triggered_update);
       break;
index 61f7b7b9df0bc63a734f48b619cc4604a1bb3a7f..69af4f214f7120ff109eb7e45f6863a1a73787a4 100644 (file)
@@ -115,8 +115,9 @@ ripng_peer_get (struct in6_addr *addr)
     }
 
   /* Update timeout thread. */
-  peer->t_timeout = thread_add_timer(master, ripng_peer_timeout, peer,
-                                     RIPNG_PEER_TIMER_DEFAULT, NULL);
+  peer->t_timeout = NULL;
+  thread_add_timer(master, ripng_peer_timeout, peer, RIPNG_PEER_TIMER_DEFAULT,
+                   &peer->t_timeout);
 
   /* Last update time set. */
   time (&peer->uptime);
index 11334339abcb66e1ec90caf2451553f0dbdc6388..e65d0b16076a756ecbcfa12f24fd12684b62e7bf 100644 (file)
@@ -1539,8 +1539,9 @@ ripng_triggered_update (struct thread *t)
      update is triggered when the timer expires. */
   interval = (random () % 5) + 1;
 
-  ripng->t_triggered_interval = 
-    thread_add_timer(master, ripng_triggered_interval, NULL, interval, NULL);
+  ripng->t_triggered_interval = NULL;
+  thread_add_timer(master, ripng_triggered_interval, NULL, interval,
+                   &ripng->t_triggered_interval);
 
   return 0;
 }
@@ -1909,9 +1910,9 @@ ripng_event (enum ripng_event event, int sock)
       /* Update timer jitter. */
       jitter = ripng_update_jitter (ripng->update_time);
 
-      ripng->t_update = 
-       thread_add_timer(master, ripng_update, NULL,
-                         sock ? 2 : ripng->update_time + jitter, NULL);
+      ripng->t_update = NULL;
+      thread_add_timer(master, ripng_update, NULL, sock ? 2 : ripng->update_time + jitter,
+                       &ripng->t_update);
       break;
     case RIPNG_TRIGGERED_UPDATE:
       if (ripng->t_triggered_interval)
index 600aef6f4629ce0f7de764bc08cdd98fcc5ba5fa..b0643b907b45821c72e678de859123b18fd0e21c 100644 (file)
@@ -139,8 +139,9 @@ int main(int argc, char **argv)
       /* Schedule timers to expire in 0..5 seconds */
       interval_msec = prng_rand(prng) % 5000;
       arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1);
-      timers[i] = thread_add_timer_msec(master, timer_func, arg,
-                                        interval_msec, NULL);
+      timers[i] = NULL;
+      thread_add_timer_msec(master, timer_func, arg, interval_msec,
+                            &timers[i]);
       ret = snprintf(arg, TIMESTR_LEN + 1, "%lld.%06lld",
                      (long long)timers[i]->u.sands.tv_sec,
                      (long long)timers[i]->u.sands.tv_usec);
index d1db4fd1bf8214967d79b39aaa03e176138c4b28..da0355f660fd136b269651d3aad4818e35f258a6 100644 (file)
@@ -56,8 +56,10 @@ int main(int argc, char **argv)
 
   /* create thread structures so they won't be allocated during the
    * time measurement */
-  for (i = 0; i < SCHEDULE_TIMERS; i++)
-    timers[i] = thread_add_timer_msec(master, dummy_func, NULL, 0, NULL);
+  for (i = 0; i < SCHEDULE_TIMERS; i++) {
+    timers[i] = NULL;
+    thread_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]);
+  }
   for (i = 0; i < SCHEDULE_TIMERS; i++)
     thread_cancel(timers[i]);
 
@@ -68,8 +70,9 @@ int main(int argc, char **argv)
       long interval_msec;
 
       interval_msec = prng_rand(prng) % (100 * SCHEDULE_TIMERS);
-      timers[i] = thread_add_timer_msec(master, dummy_func, NULL,
-                                        interval_msec, NULL);
+      timers[i] = NULL;
+      thread_add_timer_msec(master, dummy_func, NULL, interval_msec,
+                            &timers[i]);
     }
 
   monotime(&tv_lap);
index 967678633390fcd313b6eaf126c110e94fa2d015..4097cb4d660703ae975fc8c150491c3c3d0ee5c3 100644 (file)
@@ -373,8 +373,9 @@ static int restart_kill(struct thread *t_kill)
                  (long)delay.tv_sec, (restart->kills ? SIGKILL : SIGTERM));
        kill(-restart->pid, (restart->kills ? SIGKILL : SIGTERM));
        restart->kills++;
-       restart->t_kill = thread_add_timer(master, restart_kill, restart,
-                                          gs.restart_timeout, NULL);
+       restart->t_kill = NULL;
+       thread_add_timer(master, restart_kill, restart, gs.restart_timeout,
+                        &restart->t_kill);
        return 0;
 }
 
@@ -487,9 +488,9 @@ run_job(struct restart_info *restart, const char *cmdtype, const char *command,
                char cmd[strlen(command) + strlen(restart->name) + 1];
                snprintf(cmd, sizeof(cmd), command, restart->name);
                if ((restart->pid = run_background(cmd)) > 0) {
-                       restart->t_kill =
-                           thread_add_timer(master, restart_kill, restart,
-                                            gs.restart_timeout, NULL);
+                       restart->t_kill = NULL;
+                       thread_add_timer(master, restart_kill, restart, gs.restart_timeout,
+                                        &restart->t_kill);
                        restart->what = cmdtype;
                        gs.numpids++;
                } else
@@ -510,19 +511,31 @@ run_job(struct restart_info *restart, const char *cmdtype, const char *command,
 }
 
 #define SET_READ_HANDLER(DMN) \
-  (DMN)->t_read = thread_add_read(master,handle_read,(DMN),(DMN)->fd, NULL)
-
-#define SET_WAKEUP_DOWN(DMN)   \
-  (DMN)->t_wakeup = thread_add_timer_msec(master,wakeup_down,(DMN),    \
-                                         FUZZY(gs.period), NULL)
-
-#define SET_WAKEUP_UNRESPONSIVE(DMN)   \
-  (DMN)->t_wakeup = thread_add_timer_msec(master,wakeup_unresponsive,(DMN), \
-                                         FUZZY(gs.period), NULL)
+  do { \
+    (DMN)->t_read = NULL; \
+    thread_add_read (master, handle_read, (DMN), (DMN)->fd, &(DMN)->t_read); \
+  } while (0);
+
+#define SET_WAKEUP_DOWN(DMN) \
+  do { \
+    (DMN)->t_wakeup = NULL; \
+    thread_add_timer_msec (master, wakeup_down, (DMN), FUZZY(gs.period), \
+                           &(DMN)->t_wakeup); \
+  } while (0);
+
+#define SET_WAKEUP_UNRESPONSIVE(DMN) \
+  do { \
+    (DMN)->t_wakeup = NULL; \
+    thread_add_timer_msec (master, wakeup_unresponsive, (DMN), \
+                           FUZZY(gs.period), &(DMN)->t_wakeup); \
+  } while (0);
 
 #define SET_WAKEUP_ECHO(DMN) \
-  (DMN)->t_wakeup = thread_add_timer_msec(master,wakeup_send_echo,(DMN), \
-                                         FUZZY(gs.period), NULL)
+  do { \
+    (DMN)->t_wakeup = NULL; \
+    thread_add_timer_msec (master, wakeup_send_echo, (DMN), \
+                           FUZZY(gs.period), &(DMN)->t_wakeup); \
+  } while (0);
 
 static int wakeup_down(struct thread *t_wakeup)
 {
@@ -775,12 +788,11 @@ static int try_connect(struct daemon *dmn)
                        zlog_debug("%s: connection in progress", dmn->name);
                dmn->state = DAEMON_CONNECTING;
                dmn->fd = sock;
-               dmn->t_write =
-                   thread_add_write(master, check_connect, dmn, dmn->fd,
-                                    NULL);
-               dmn->t_wakeup =
-                   thread_add_timer(master, wakeup_connect_hanging, dmn,
-                                    gs.timeout, NULL);
+               dmn->t_write = NULL;
+               thread_add_write(master, check_connect, dmn, dmn->fd,
+                                &dmn->t_write);dmn->t_wakeup = NULL;
+               thread_add_timer(master, wakeup_connect_hanging, dmn, gs.timeout,
+                                &dmn->t_wakeup);
                SET_READ_HANDLER(dmn);
                return 0;
        }
@@ -805,8 +817,9 @@ static void set_phase(restart_phase_t new_phase)
        gs.phase = new_phase;
        if (gs.t_phase_hanging)
                thread_cancel(gs.t_phase_hanging);
-       gs.t_phase_hanging = thread_add_timer(master, phase_hanging, NULL,
-                                             PHASE_TIMEOUT, NULL);
+       gs.t_phase_hanging = NULL;
+       thread_add_timer(master, phase_hanging, NULL, PHASE_TIMEOUT,
+                        &gs.t_phase_hanging);
 }
 
 static void phase_check(void)
@@ -963,9 +976,9 @@ static int wakeup_send_echo(struct thread *t_wakeup)
                daemon_down(dmn, why);
        } else {
                gettimeofday(&dmn->echo_sent, NULL);
-               dmn->t_wakeup =
-                   thread_add_timer(master, wakeup_no_answer, dmn,
-                                    gs.timeout, NULL);
+               dmn->t_wakeup = NULL;
+               thread_add_timer(master, wakeup_no_answer, dmn, gs.timeout,
+                                &dmn->t_wakeup);
        }
        return 0;
 }
@@ -1312,10 +1325,9 @@ int main(int argc, char **argv)
                        gs.numdaemons++;
                        gs.numdown++;
                        dmn->fd = -1;
-                       dmn->t_wakeup =
-                           thread_add_timer_msec(master, wakeup_init, dmn,
-                                                 100 + (random() % 900),
-                                                 NULL);
+                       dmn->t_wakeup = NULL;
+                       thread_add_timer_msec(master, wakeup_init, dmn, 100 + (random() % 900),
+                                             &dmn->t_wakeup);
                        dmn->restart.interval = gs.min_restart_interval;
                        if (tail)
                                tail->next = dmn;
index cb0cb349deab08c773a092e47d6c605586a7cb73..21f8beadf23d8ab8a644b088d7bd363c89efe7a7 100644 (file)
@@ -259,8 +259,9 @@ irdp_if_start(struct interface *ifp, int multicast, int set_defaults)
               ifp->name,
               timer);
 
-  irdp->t_advertise = thread_add_timer(zebrad.master, irdp_send_thread, ifp,
-                                       timer, NULL);
+  irdp->t_advertise = NULL;
+  thread_add_timer(zebrad.master, irdp_send_thread, ifp, timer,
+                   &irdp->t_advertise);
 }
 
 static void
index 963c330af41f4f2d65010071a7c6ccb995a3b554..5c17570f05fe50d48abc76f60ed2e5d6b34a6b20 100644 (file)
@@ -114,7 +114,8 @@ irdp_sock_init (void)
     return ret;
   };
 
-  t_irdp_raw = thread_add_read(zebrad.master, irdp_read_raw, NULL, sock, NULL);
+  t_irdp_raw = NULL;
+  thread_add_read(zebrad.master, irdp_read_raw, NULL, sock, &t_irdp_raw);
 
   return sock;
 }
@@ -244,8 +245,9 @@ int irdp_send_thread(struct thread *t_advert)
   if(irdp->flags & IF_DEBUG_MISC)
     zlog_debug("IRDP: New timer for %s set to %u\n", ifp->name, timer);
 
-  irdp->t_advertise = thread_add_timer(zebrad.master, irdp_send_thread, ifp,
-                                       timer, NULL);
+  irdp->t_advertise = NULL;
+  thread_add_timer(zebrad.master, irdp_send_thread, ifp, timer,
+                   &irdp->t_advertise);
   return 0;
 }
 
@@ -297,8 +299,9 @@ void process_solicit (struct interface *ifp)
 
   timer =  (random () % MAX_RESPONSE_DELAY) + 1;
 
-  irdp->t_advertise = thread_add_timer(zebrad.master, irdp_send_thread, ifp,
-                                       timer, NULL);
+  irdp->t_advertise = NULL;
+  thread_add_timer(zebrad.master, irdp_send_thread, ifp, timer,
+                   &irdp->t_advertise);
 }
 
 void irdp_finish()
index ecca40393f50354b875ba05a82a910dfa697b992..269d4c04490e9ad1b870bf6dff5dc843ecbfe290 100644 (file)
@@ -232,8 +232,8 @@ int irdp_read_raw(struct thread *r)
   int ret, ifindex = 0;
   
   int irdp_sock = THREAD_FD (r);
-  t_irdp_raw = thread_add_read(zebrad.master, irdp_read_raw, NULL, irdp_sock,
-                               NULL);
+  t_irdp_raw = NULL;
+  thread_add_read(zebrad.master, irdp_read_raw, NULL, irdp_sock, &t_irdp_raw);
   
   ret = irdp_recvmsg (irdp_sock, (u_char *) buf, IRDP_RX_BUF,  &ifindex);
  
index 59a280f826a98a031bdb68122f48adc03ce885b1..763cd4adda25dbd3cfbedc8cfb15d049b1d46fad 100644 (file)
@@ -283,8 +283,9 @@ kernel_read (struct thread *thread)
 {
   struct zebra_ns *zns = (struct zebra_ns *)THREAD_ARG (thread);
   netlink_parse_info (netlink_information_fetch, &zns->netlink, zns, 5, 0);
-  zns->t_netlink = thread_add_read(zebrad.master, kernel_read, zns,
-                                   zns->netlink.sock, NULL);
+  zns->t_netlink = NULL;
+  thread_add_read(zebrad.master, kernel_read, zns, zns->netlink.sock,
+                  &zns->t_netlink);
 
   return 0;
 }
@@ -813,8 +814,9 @@ kernel_init (struct zebra_ns *zns)
         netlink_recvbuf (&zns->netlink, nl_rcvbufsize);
 
       netlink_install_filter (zns->netlink.sock, zns->netlink_cmd.snl.nl_pid);
-      zns->t_netlink = thread_add_read(zebrad.master, kernel_read, zns,
-                                       zns->netlink.sock, NULL);
+      zns->t_netlink = NULL;
+      thread_add_read(zebrad.master, kernel_read, zns, zns->netlink.sock,
+                      &zns->t_netlink);
     }
 }
 
index 281672c9ad77abb235612e5700034acd91bba862..e8fa6e116cef127b5e61968426d3d52844a3fb10 100644 (file)
@@ -565,9 +565,9 @@ zfpm_conn_up_thread_cb (struct thread *thread)
 
       zfpm_g->stats.t_conn_up_yields++;
       zfpm_rnodes_iter_pause (iter);
-      zfpm_g->t_conn_up = thread_add_background(zfpm_g->master,
-                                                zfpm_conn_up_thread_cb, 0, 0,
-                                                NULL);
+      zfpm_g->t_conn_up = NULL;
+      thread_add_background(zfpm_g->master, zfpm_conn_up_thread_cb, 0, 0,
+                            &zfpm_g->t_conn_up);
       return 0;
     }
 
@@ -599,9 +599,9 @@ zfpm_connection_up (const char *detail)
   zfpm_rnodes_iter_init (&zfpm_g->t_conn_up_state.iter);
 
   zfpm_debug ("Starting conn_up thread");
-  zfpm_g->t_conn_up = thread_add_background(zfpm_g->master,
-                                            zfpm_conn_up_thread_cb, 0, 0,
-                                            NULL);
+  zfpm_g->t_conn_up = NULL;
+  thread_add_background(zfpm_g->master, zfpm_conn_up_thread_cb, 0, 0,
+                        &zfpm_g->t_conn_up);
   zfpm_g->stats.t_conn_up_starts++;
 }
 
@@ -690,9 +690,9 @@ zfpm_conn_down_thread_cb (struct thread *thread)
 
       zfpm_g->stats.t_conn_down_yields++;
       zfpm_rnodes_iter_pause (iter);
-      zfpm_g->t_conn_down = thread_add_background(zfpm_g->master,
-                                                  zfpm_conn_down_thread_cb, 0,
-                                                  0, NULL);
+      zfpm_g->t_conn_down = NULL;
+      thread_add_background(zfpm_g->master, zfpm_conn_down_thread_cb, 0, 0,
+                            &zfpm_g->t_conn_down);
       return 0;
     }
 
@@ -738,9 +738,9 @@ zfpm_connection_down (const char *detail)
   assert (!zfpm_g->t_conn_down);
   zfpm_debug ("Starting conn_down thread");
   zfpm_rnodes_iter_init (&zfpm_g->t_conn_down_state.iter);
-  zfpm_g->t_conn_down = thread_add_background(zfpm_g->master,
-                                              zfpm_conn_down_thread_cb, 0, 0,
-                                              NULL);
+  zfpm_g->t_conn_down = NULL;
+  thread_add_background(zfpm_g->master, zfpm_conn_down_thread_cb, 0, 0,
+                        &zfpm_g->t_conn_down);
   zfpm_g->stats.t_conn_down_starts++;
 
   zfpm_set_state (ZFPM_STATE_IDLE, detail);
index 85f3efae8ec77b2fb1b204e533686ab583d9d49b..4141cdd90769a9bd939ab277d1d2656eb00cde9a 100644 (file)
@@ -182,13 +182,14 @@ zebra_ptm_flush_messages (struct thread *thread)
       close(ptm_cb.ptm_sock);
       ptm_cb.ptm_sock = -1;
       zebra_ptm_reset_status(0);
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return (-1);
     case BUFFER_PENDING:
-      ptm_cb.t_write = thread_add_write(zebrad.master,
-                                        zebra_ptm_flush_messages, NULL,
-                                        ptm_cb.ptm_sock, NULL);
+      ptm_cb.t_write = NULL;
+      thread_add_write(zebrad.master, zebra_ptm_flush_messages, NULL, ptm_cb.ptm_sock,
+                       &ptm_cb.t_write);
       break;
     case BUFFER_EMPTY:
       break;
@@ -208,8 +209,9 @@ zebra_ptm_send_message(char *data, int size)
       close(ptm_cb.ptm_sock);
       ptm_cb.ptm_sock = -1;
       zebra_ptm_reset_status(0);
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return -1;
     case BUFFER_EMPTY:
       THREAD_OFF(ptm_cb.t_write);
@@ -235,8 +237,9 @@ zebra_ptm_connect (struct thread *t)
 
   if (ptm_cb.ptm_sock != -1) {
     if (init) {
-      ptm_cb.t_read = thread_add_read(zebrad.master, zebra_ptm_sock_read,
-                                      NULL, ptm_cb.ptm_sock, NULL);
+      ptm_cb.t_read = NULL;
+      thread_add_read(zebrad.master, zebra_ptm_sock_read, NULL, ptm_cb.ptm_sock,
+                      &ptm_cb.t_read);
       zebra_bfd_peer_replay_req();
     }
     zebra_ptm_send_status_req();
@@ -246,8 +249,9 @@ zebra_ptm_connect (struct thread *t)
     if (ptm_cb.reconnect_time > ZEBRA_PTM_RECONNECT_TIME_MAX)
       ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_MAX;
 
-    ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect, NULL,
-                                      ptm_cb.reconnect_time, NULL);
+    ptm_cb.t_timer = NULL;
+    thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                     &ptm_cb.t_timer);
   } else if (ptm_cb.reconnect_time >= ZEBRA_PTM_RECONNECT_TIME_MAX){
     ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_INITIAL;
   }
@@ -654,14 +658,16 @@ zebra_ptm_sock_read (struct thread *thread)
       close (ptm_cb.ptm_sock);
       ptm_cb.ptm_sock = -1;
       zebra_ptm_reset_status(0);
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return (-1);
     }
   }
 
-  ptm_cb.t_read = thread_add_read(zebrad.master, zebra_ptm_sock_read, NULL,
-                                  ptm_cb.ptm_sock, NULL);
+  ptm_cb.t_read = NULL;
+  thread_add_read(zebrad.master, zebra_ptm_sock_read, NULL, ptm_cb.ptm_sock,
+                  &ptm_cb.t_read);
 
   return 0;
 }
@@ -698,8 +704,9 @@ zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length,
 
   if (ptm_cb.ptm_sock == -1)
     {
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return -1;
     }
 
@@ -855,8 +862,9 @@ zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock, u_short length,
 
   if (ptm_cb.ptm_sock == -1)
     {
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return -1;
     }
 
@@ -977,8 +985,9 @@ zebra_ptm_bfd_client_register (struct zserv *client, int sock, u_short length)
 
   if (ptm_cb.ptm_sock == -1)
     {
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return -1;
     }
 
@@ -1027,8 +1036,9 @@ zebra_ptm_bfd_client_deregister (int proto)
 
   if (ptm_cb.ptm_sock == -1)
     {
-      ptm_cb.t_timer = thread_add_timer(zebrad.master, zebra_ptm_connect,
-                                        NULL, ptm_cb.reconnect_time, NULL);
+      ptm_cb.t_timer = NULL;
+      thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time,
+                       &ptm_cb.t_timer);
       return;
     }
 
index 0b69475dae55758851653eae0579e39382936bfa..1738b0b0538fa443fcc5c971c56c0a6d661de971 100644 (file)
@@ -1403,10 +1403,11 @@ static void
 zebra_route_map_mark_update (const char *rmap_name)
 {
   /* rmap_update_timer of 0 means don't do route updates */
-  if (zebra_rmap_update_timer && !zebra_t_rmap_update)
-    zebra_t_rmap_update =
-      thread_add_timer(zebrad.master, zebra_route_map_update_timer, NULL,
-                       zebra_rmap_update_timer, NULL);
+  if (zebra_rmap_update_timer && !zebra_t_rmap_update) {
+    zebra_t_rmap_update = NULL;
+    thread_add_timer(zebrad.master, zebra_route_map_update_timer, NULL, zebra_rmap_update_timer,
+                     &zebra_t_rmap_update);
+  }
 }
 
 static void
index 86fea32621fb61a2fdcfaf199a63675c22d4c487..142956bdcffeca5d5b767e132c862ff3533f50e7 100644 (file)
@@ -95,8 +95,9 @@ zserv_flush_data(struct thread *thread)
       client = NULL;
       break;
     case BUFFER_PENDING:
-      client->t_write = thread_add_write(zebrad.master, zserv_flush_data,
-                                         client, client->sock, NULL);
+      client->t_write = NULL;
+      thread_add_write(zebrad.master, zserv_flush_data, client, client->sock,
+                       &client->t_write);
       break;
     case BUFFER_EMPTY:
       break;
@@ -128,8 +129,9 @@ zebra_server_send_message(struct zserv *client)
          one do not check the return code.  They do not allow for the
         possibility that an I/O error may have caused the client to be
         deleted. */
-      client->t_suicide = thread_add_event(zebrad.master, zserv_delayed_close,
-                                           client, 0, NULL);
+      client->t_suicide = NULL;
+      thread_add_event(zebrad.master, zserv_delayed_close, client, 0,
+                       &client->t_suicide);
       return -1;
     case BUFFER_EMPTY:
       THREAD_OFF(client->t_write);
@@ -2591,8 +2593,9 @@ zebra_event (enum event event, int sock, struct zserv *client)
       thread_add_read(zebrad.master, zebra_accept, client, sock, NULL);
       break;
     case ZEBRA_READ:
-      client->t_read = 
-       thread_add_read(zebrad.master, zebra_client_read, client, sock, NULL);
+      client->t_read = NULL;
+      thread_add_read(zebrad.master, zebra_client_read, client, sock,
+                      &client->t_read);
       break;
     case ZEBRA_WRITE:
       /**/