Threads usage cleanup. Still at least one bug to go.
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 3f6a57b..0faadbd 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -1652,8 +1652,7 @@
 int
 lsp_l1_generate (struct isis_area *area)
 {
-  
-  area->t_lsp_refresh[0] = thread_add_timer (master, lsp_refresh_l1, area, 
+  THREAD_TIMER_ON(master, area->t_lsp_refresh[0], lsp_refresh_l1, area,
                                              MAX_LSP_GEN_INTERVAL);
 
   return lsp_generate_non_pseudo (area, 1);
@@ -1666,8 +1665,7 @@
 int
 lsp_l2_generate (struct isis_area *area)
 {
-  
-  area->t_lsp_refresh[1] = thread_add_timer (master, lsp_refresh_l2, area, 
+  THREAD_TIMER_ON(master, area->t_lsp_refresh[1], lsp_refresh_l2, area,
                                              MAX_LSP_GEN_INTERVAL);
 
   return lsp_generate_non_pseudo (area, 2);
@@ -1753,9 +1751,9 @@
   ref_time =  area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ? 
     MAX_LSP_GEN_INTERVAL : area->lsp_refresh[0];
 
-  area->t_lsp_refresh[0] = thread_add_timer (master, lsp_refresh_l1, area,
-                                          isis_jitter (ref_time, 
-                                                       MAX_AGE_JITTER));
+  THREAD_TIMER_ON(master, area->t_lsp_refresh[0], lsp_refresh_l1, area,
+      isis_jitter(ref_time, MAX_AGE_JITTER));
+
   return ISIS_OK;
 }
 
@@ -1775,10 +1773,9 @@
   ref_time =  area->lsp_refresh[1] > MAX_LSP_GEN_INTERVAL ? 
     MAX_LSP_GEN_INTERVAL : area->lsp_refresh[1];
 
+  THREAD_TIMER_ON(master, area->t_lsp_refresh[1], lsp_refresh_l2, area,
+      isis_jitter(ref_time, MAX_AGE_JITTER));
 
-  area->t_lsp_refresh[1] = thread_add_timer (master, lsp_refresh_l2, area,
-                                          isis_jitter (ref_time, 
-                                                       MAX_AGE_JITTER));
   return ISIS_OK;
 }
 
@@ -2018,10 +2015,9 @@
   ref_time =  circuit->area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ? 
     MAX_LSP_GEN_INTERVAL : circuit->area->lsp_refresh[0];
 
-  circuit->u.bc.t_refresh_pseudo_lsp[0] = 
-    thread_add_timer (master, lsp_l1_refresh_pseudo, circuit, 
-                      isis_jitter (ref_time,
-                                   MAX_AGE_JITTER));
+  THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[0],
+      lsp_l1_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
+  
   return retval;
 }
 
@@ -2053,11 +2049,8 @@
   ref_time =  circuit->area->lsp_refresh[0] > MAX_LSP_GEN_INTERVAL ? 
     MAX_LSP_GEN_INTERVAL : circuit->area->lsp_refresh[0];
 
-  
-  circuit->u.bc.t_refresh_pseudo_lsp[0] = 
-    thread_add_timer (master, lsp_l1_refresh_pseudo, circuit, 
-                      isis_jitter (ref_time,
-                                   MAX_AGE_JITTER));
+  THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[0],
+      lsp_l1_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
 
   return lsp_regenerate_schedule (circuit->area);
 }
@@ -2078,11 +2071,9 @@
   ref_time =  circuit->area->lsp_refresh[1] > MAX_LSP_GEN_INTERVAL ? 
     MAX_LSP_GEN_INTERVAL : circuit->area->lsp_refresh[1];
 
+  THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[1],
+      lsp_l2_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
 
-  circuit->u.bc.t_refresh_pseudo_lsp[1] = 
-    thread_add_timer (master, lsp_l2_refresh_pseudo, circuit, 
-                      isis_jitter (ref_time,
-                                   MAX_AGE_JITTER));
   return retval;
 }
 
@@ -2114,10 +2105,8 @@
   lsp_insert (lsp, circuit->area->lspdb[1]);
   ISIS_FLAGS_SET_ALL (lsp->SRMflags);
       
-  circuit->u.bc.t_refresh_pseudo_lsp[1] = 
-    thread_add_timer (master, lsp_l2_refresh_pseudo, circuit, 
-                      isis_jitter (ref_time,
-                                   MAX_AGE_JITTER));
+  THREAD_TIMER_ON(master, circuit->u.bc.t_refresh_pseudo_lsp[1],
+      lsp_l2_refresh_pseudo, circuit, isis_jitter (ref_time, MAX_AGE_JITTER));
   
   return lsp_regenerate_schedule (circuit->area);
 }
@@ -2144,7 +2133,7 @@
   
   area = THREAD_ARG (thread);
   assert (area);
-  area->t_tick = thread_add_timer (master, lsp_tick, area, 1);
+  THREAD_TIMER_ON(master, area->t_tick, lsp_tick, area, 1);
 
   /*
    * Build a list of LSPs with (any) SRMflag set
@@ -2289,10 +2278,8 @@
   /* time to calculate our checksum */
   iso_csum_create (STREAM_DATA (lsp->pdu) + 12,
                    ntohs(lsp->lsp_header->pdu_len) - 12, 12);
-
-  lsp->t_lsp_top_ref = thread_add_timer (master, top_lsp_refresh, lsp,
-                                         isis_jitter (MAX_LSP_GEN_INTERVAL,
-                                                      MAX_LSP_GEN_JITTER));
+  THREAD_TIMER_ON(master, lsp->t_lsp_top_ref, top_lsp_refresh, lsp,
+      isis_jitter (MAX_LSP_GEN_INTERVAL, MAX_LSP_GEN_JITTER));
 
   return ISIS_OK;
 }
@@ -2328,9 +2315,8 @@
     /* time to calculate our checksum */
     iso_csum_create (STREAM_DATA (lsp->pdu) + 12,
 		     ntohs(lsp->lsp_header->pdu_len) - 12, 12);
-    lsp->t_lsp_top_ref = thread_add_timer (master, top_lsp_refresh, lsp,
-					   isis_jitter(MAX_LSP_GEN_INTERVAL,
-						       MAX_LSP_GEN_JITTER));
+    THREAD_TIMER_ON(master, lsp->t_lsp_top_ref, top_lsp_refresh, lsp,
+        isis_jitter(MAX_LSP_GEN_INTERVAL, MAX_LSP_GEN_JITTER));
 
     ISIS_FLAGS_SET_ALL(lsp->SRMflags);
     lsp_insert (lsp,area->lspdb[0]);
@@ -2349,7 +2335,7 @@
     dnode_next = dict_next (area->lspdb[0], dnode);
     lsp = dnode_get (dnode);
     if (lsp->from_topology) {
-      thread_cancel(lsp->t_lsp_top_ref);
+      THREAD_TIMER_OFF(lsp->t_lsp_top_ref);
       lsp_destroy (lsp);
       dict_delete (area->lspdb[0], dnode);
     }