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 ();
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;
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);
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;
paf = THREAD_ARG (t);
peer = paf->peer;
- assert (paf->t_announce_route);
- paf->t_announce_route = NULL;
-
if (peer->status != Established)
return 0;
/* 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))
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);
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
{
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) */
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);
}
/*
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
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);
}
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);
}
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);
{
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
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
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);
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
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
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;
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
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)
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;
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
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))
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)
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 */
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;
{
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...");
/* 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;
/* 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
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
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
}
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
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));
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) {
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;
}
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);
}
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;
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;
}
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 */
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 */
}
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;
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:
}
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;
}
&& (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);
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;
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;
}
}
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))
}
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;
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++;
}
(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
{
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);
}
}
}
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
{
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
{
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;
}
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;
}
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;
}
/* 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);
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;
/* 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;
}
/* 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)) ||
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;
}
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);
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));
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;
}
/* 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;
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;
}
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;
/* 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,
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;
}
{
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);
}
}
}
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 &&
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;
}
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;
}
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
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 */
(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;
}
}
}
}
- 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))
{
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;
}
*/
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;
}
*/
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;
}
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
}
/* 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;
}
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)))
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)
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);
}
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. */
/* 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)
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;
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;
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;
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);
/* 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;
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__);
}
/* 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);
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;
}
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;
}
/* 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);
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;
}
/* 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)
/* 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);
/* 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]);
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);
(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;
}
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
}
#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)
{
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;
}
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)
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;
}
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;
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
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;
}
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;
}
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()
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);
{
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;
}
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);
}
}
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;
}
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++;
}
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;
}
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);
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;
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);
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();
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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
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;
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);
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:
/**/