diff options
author | hasso <hasso> | 2004-02-11 20:26:31 +0000 |
---|---|---|
committer | hasso <hasso> | 2004-02-11 20:26:31 +0000 |
commit | d70f99e15b7849f59b970bd62392ed42bda25ab6 (patch) | |
tree | ed59bcf87fa39e18ef82e21ae59fa9e842622a67 /isisd/isis_circuit.c | |
parent | 83fe45e30e12eb8af8b7cc413e1ae5ef81bde97e (diff) |
Threads usage cleanup. Still at least one bug to go.
Diffstat (limited to 'isisd/isis_circuit.c')
-rw-r--r-- | isisd/isis_circuit.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index fce59979..1865e33e 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -414,12 +414,12 @@ isis_circuit_up (struct isis_circuit *circuit) /* 8.4.1 d) */ /* dr election will commence in... */ if (circuit->circuit_is_type & IS_LEVEL_1) - circuit->u.bc.t_run_dr[0] = - thread_add_timer (master, isis_run_dr_l1, circuit, + THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1, + circuit, 2 * circuit->hello_multiplier[0] * circuit->hello_interval[0]); if (circuit->circuit_is_type & IS_LEVEL_2) - circuit->u.bc.t_run_dr[1] = - thread_add_timer (master, isis_run_dr_l2, circuit, + THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2, + circuit, 2 * circuit->hello_multiplier[1] * circuit->hello_interval[1]); } else { /* initializing the hello send threads @@ -431,22 +431,13 @@ isis_circuit_up (struct isis_circuit *circuit) /* initializing PSNP timers */ if (circuit->circuit_is_type & IS_LEVEL_1) { - circuit->t_send_psnp[0] = thread_add_timer (master, - send_l1_psnp, - circuit, - isis_jitter - (circuit->psnp_interval[0], - PSNP_JITTER)); + THREAD_TIMER_ON(master, circuit->t_send_psnp[0], send_l1_psnp, circuit, + isis_jitter(circuit->psnp_interval[0], PSNP_JITTER)); } if (circuit->circuit_is_type & IS_LEVEL_2) { - circuit->t_send_psnp[1] = thread_add_timer (master, - send_l2_psnp, - circuit, - isis_jitter - (circuit->psnp_interval[1], - PSNP_JITTER)); - + THREAD_TIMER_ON(master, circuit->t_send_psnp[1], send_l2_psnp, circuit, + isis_jitter(circuit->psnp_interval[1], PSNP_JITTER)); } /* initialize the circuit streams */ @@ -460,10 +451,10 @@ isis_circuit_up (struct isis_circuit *circuit) isis_sock_init (circuit); #ifdef GNU_LINUX - circuit->t_read = thread_add_read (master, isis_receive, circuit, + THREAD_READ_ON(master, circuit->t_read, isis_receive, circuit, circuit->fd); #else - circuit->t_read = thread_add_timer (master, isis_receive, circuit, + THREAD_TIMER_ON(master, circuit->t_read, isis_receive, circuit, circuit->fd); #endif return; @@ -473,16 +464,13 @@ void isis_circuit_down (struct isis_circuit *circuit) { /* Cancel all active threads -- FIXME: wrong place*/ - if (circuit->t_read) - thread_cancel (circuit->t_read); + /* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */ + THREAD_OFF(circuit->t_read); if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - if (circuit->u.bc.t_send_lan_hello[0]) - thread_cancel (circuit->u.bc.t_send_lan_hello[0]); - if (circuit->u.bc.t_send_lan_hello[1]) - thread_cancel (circuit->u.bc.t_send_lan_hello[1]); + THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[0]); + THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[1]); } else if (circuit->circ_type == CIRCUIT_T_P2P) { - if (circuit->u.p2p.t_send_p2p_hello) - thread_cancel (circuit->u.p2p.t_send_p2p_hello); + THREAD_TIMER_OFF(circuit->u.p2p.t_send_p2p_hello); } /* close the socket */ close (circuit->fd); |