Sfoglia il codice sorgente

core: timer - coherent indentation and whitespacing

Daniel-Constantin Mierla 9 anni fa
parent
commit
7145a6f042
7 ha cambiato i file con 106 aggiunte e 106 eliminazioni
  1. 1 1
      ser_time.h
  2. 57 57
      timer.c
  3. 14 14
      timer.h
  4. 9 9
      timer_funcs.h
  5. 15 15
      timer_proc.c
  6. 8 8
      timer_proc.h
  7. 2 2
      timer_ticks.h

+ 1 - 1
ser_time.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * time related functions
  * time related functions
  *
  *
  * Copyright (C) 2006 iptelorg GmbH
  * Copyright (C) 2006 iptelorg GmbH

+ 57 - 57
timer.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -62,8 +62,8 @@ static ticks_t* ticks=0;
 static ticks_t last_ticks; /* last time we adjusted the time */
 static ticks_t last_ticks; /* last time we adjusted the time */
 static ticks_t last_adj_check; /* last time we ran adjust_ticks */
 static ticks_t last_adj_check; /* last time we ran adjust_ticks */
 static ticks_t prev_ticks; /* last time we ran the timer, also used as
 static ticks_t prev_ticks; /* last time we ran the timer, also used as
-							  "current" ticks when running the timer for
-							  "skipped" ticks */
+							*  "current" ticks when running the timer for
+							*  "skipped" ticks */
 
 
 static struct timeval last_time;
 static struct timeval last_time;
 static struct timeval start_time; /* for debugging */
 static struct timeval start_time; /* for debugging */
@@ -100,11 +100,11 @@ static int in_timer=0;
 
 
 
 
 static gen_lock_t*  slow_timer_lock; /* slow timer lock */
 static gen_lock_t*  slow_timer_lock; /* slow timer lock */
-static struct timer_head* slow_timer_lists; 
+static struct timer_head* slow_timer_lists;
 static volatile unsigned short* t_idx; /* "main" timer index in slow_lists[] */
 static volatile unsigned short* t_idx; /* "main" timer index in slow_lists[] */
 static volatile unsigned short* s_idx; /* "slow" timer index in slow_lists[] */
 static volatile unsigned short* s_idx; /* "slow" timer index in slow_lists[] */
 static struct timer_ln* volatile* running_timer2=0; /* timer handler running
 static struct timer_ln* volatile* running_timer2=0; /* timer handler running
-													     in the "slow" timer */
+													 * in the "slow" timer */
 static sigset_t slow_timer_sset;
 static sigset_t slow_timer_sset;
 pid_t slow_timer_pid;
 pid_t slow_timer_pid;
 static int in_slow_timer=0;
 static int in_slow_timer=0;
@@ -137,10 +137,10 @@ void sig_timer(int signo)
 void destroy_timer()
 void destroy_timer()
 {
 {
 	struct itimerval it;
 	struct itimerval it;
-	
+
 	/* disable timer */
 	/* disable timer */
 	memset(&it, 0, sizeof(it));
 	memset(&it, 0, sizeof(it));
-	setitimer(ITIMER_REAL, &it, 0); 
+	setitimer(ITIMER_REAL, &it, 0);
 	set_sig_h(SIGALRM, SIG_IGN);
 	set_sig_h(SIGALRM, SIG_IGN);
 	if (timer_lock){
 	if (timer_lock){
 		lock_destroy(timer_lock);
 		lock_destroy(timer_lock);
@@ -199,9 +199,9 @@ int init_timer()
 {
 {
 	int r;
 	int r;
 	int ret;
 	int ret;
-	
+
 	ret=-1;
 	ret=-1;
-	
+
 	/* init the locks */
 	/* init the locks */
 	timer_lock=lock_alloc();
 	timer_lock=lock_alloc();
 	if (timer_lock==0){
 	if (timer_lock==0){
@@ -253,7 +253,7 @@ int init_timer()
 	}
 	}
 	last_time=start_time;
 	last_time=start_time;
 	LM_DBG("starting with *ticks=%u\n", (unsigned) *ticks);
 	LM_DBG("starting with *ticks=%u\n", (unsigned) *ticks);
-	
+
 	/* init timer structures */
 	/* init timer structures */
 	for (r=0; r<H0_ENTRIES; r++)
 	for (r=0; r<H0_ENTRIES; r++)
 		_timer_init_list(&timer_lst->h0[r]);
 		_timer_init_list(&timer_lst->h0[r]);
@@ -262,9 +262,9 @@ int init_timer()
 	for (r=0; r<H2_ENTRIES; r++)
 	for (r=0; r<H2_ENTRIES; r++)
 		_timer_init_list(&timer_lst->h2[r]);
 		_timer_init_list(&timer_lst->h2[r]);
 	_timer_init_list(&timer_lst->expired);
 	_timer_init_list(&timer_lst->expired);
-	
+
 #ifdef USE_SLOW_TIMER
 #ifdef USE_SLOW_TIMER
-	
+
 	/* init the locks */
 	/* init the locks */
 	slow_timer_lock=lock_alloc();
 	slow_timer_lock=lock_alloc();
 	if (slow_timer_lock==0){
 	if (slow_timer_lock==0){
@@ -290,9 +290,9 @@ int init_timer()
 	*running_timer2=0;
 	*running_timer2=0;
 	for (r=0; r<SLOW_LISTS_NO; r++)
 	for (r=0; r<SLOW_LISTS_NO; r++)
 		_timer_init_list(&slow_timer_lists[r]);
 		_timer_init_list(&slow_timer_lists[r]);
-	
+
 #endif
 #endif
-	
+
 	LM_DBG("timer_list between %p and %p\n",
 	LM_DBG("timer_list between %p and %p\n",
 			&timer_lst->h0[0], &timer_lst->h2[H2_ENTRIES]);
 			&timer_lst->h0[0], &timer_lst->h2[H2_ENTRIES]);
 	return 0;
 	return 0;
@@ -304,7 +304,7 @@ error:
 
 
 
 
 #ifdef USE_SLOW_TIMER
 #ifdef USE_SLOW_TIMER
-/* arm the "slow" timer ( start it) 
+/* arm the "slow" timer ( start it)
  * returns -1 on error
  * returns -1 on error
  * WARNING: use it in the same process as the timer
  * WARNING: use it in the same process as the timer
  *  (the one using pause(); timer_handler()) or
  *  (the one using pause(); timer_handler()) or
@@ -321,7 +321,7 @@ again:
 	}
 	}
 #ifdef __OS_darwin
 #ifdef __OS_darwin
 	/* workaround for darwin sigwait bug, see slow_timer_main() for more
 	/* workaround for darwin sigwait bug, see slow_timer_main() for more
-	   info (or grep __OS_darwin) */
+	 * info (or grep __OS_darwin) */
 	/* keep in sync wih main.c: sig_usr() - signals we are interested in */
 	/* keep in sync wih main.c: sig_usr() - signals we are interested in */
 	sigaddset(&slow_timer_sset, SIGINT);
 	sigaddset(&slow_timer_sset, SIGINT);
 	sigaddset(&slow_timer_sset, SIGTERM);
 	sigaddset(&slow_timer_sset, SIGTERM);
@@ -342,7 +342,7 @@ error:
 
 
 
 
 
 
-/* arm the timer ( start it) 
+/* arm the timer ( start it)
  * returns -1 on error
  * returns -1 on error
  * WARNING: use it in the same process as the timer
  * WARNING: use it in the same process as the timer
  *  (the one using pause(); timer_handler()) or
  *  (the one using pause(); timer_handler()) or
@@ -398,7 +398,7 @@ inline static void adjust_ticks(void)
 	ticks_t diff_time_ticks;
 	ticks_t diff_time_ticks;
 	ticks_t diff_ticks_raw;
 	ticks_t diff_ticks_raw;
 	s_ticks_t delta;
 	s_ticks_t delta;
-	
+
 	/* fix ticks if necessary */
 	/* fix ticks if necessary */
 	if ((*ticks-last_adj_check)>=(ticks_t)TIMER_RESYNC_TICKS){
 	if ((*ticks-last_adj_check)>=(ticks_t)TIMER_RESYNC_TICKS){
 #ifdef DBG_ser_time
 #ifdef DBG_ser_time
@@ -423,7 +423,7 @@ inline static void adjust_ticks(void)
 			if (delta<-1){
 			if (delta<-1){
 				LM_WARN("our timer runs faster then real-time"
 				LM_WARN("our timer runs faster then real-time"
 						" (%lu ms / %u ticks our time .->"
 						" (%lu ms / %u ticks our time .->"
-						 " %lu ms / %u ticks real time)\n", 
+						" %lu ms / %u ticks real time)\n",
 						(unsigned long)(diff_ticks_raw*1000L/TIMER_TICKS_HZ),
 						(unsigned long)(diff_ticks_raw*1000L/TIMER_TICKS_HZ),
 						diff_ticks_raw,
 						diff_ticks_raw,
 						(unsigned long)(diff_time/1000), diff_time_ticks);
 						(unsigned long)(diff_time/1000), diff_time_ticks);
@@ -463,7 +463,7 @@ time_t ser_time(time_t *t)
 
 
 
 
 
 
-/* gettimeofday(2) equivalent, using ser internal timers (faster 
+/* gettimeofday(2) equivalent, using ser internal timers (faster
  * but more imprecise)
  * but more imprecise)
  * WARNING: ignores tz (it's obsolete anyway)*/
  * WARNING: ignores tz (it's obsolete anyway)*/
 int ser_gettimeofday(struct timeval* tv, struct timezone* tz)
 int ser_gettimeofday(struct timeval* tv, struct timezone* tz)
@@ -485,22 +485,22 @@ void check_ser_drift()
 	time_t t1, t2;
 	time_t t1, t2;
 	struct timeval tv1, tv2;
 	struct timeval tv1, tv2;
 	int r;
 	int r;
-	
+
 	t1=time(0);
 	t1=time(0);
 	t2=ser_time(0);
 	t2=ser_time(0);
 	if (t1!=t2)
 	if (t1!=t2)
 		BUG("time(0)!=ser_time(0) : %d != %d \n", (unsigned)t1, (unsigned)t2);
 		BUG("time(0)!=ser_time(0) : %d != %d \n", (unsigned)t1, (unsigned)t2);
-	
+
 	r=gettimeofday(&tv1, 0);
 	r=gettimeofday(&tv1, 0);
 	ser_gettimeofday(&tv2, 0);
 	ser_gettimeofday(&tv2, 0);
 	if (tv1.tv_sec!=tv2.tv_sec)
 	if (tv1.tv_sec!=tv2.tv_sec)
 		BUG("gettimeofday seconds!=ser_gettimeofday seconds : %d != %d \n",
 		BUG("gettimeofday seconds!=ser_gettimeofday seconds : %d != %d \n",
 				(unsigned)tv1.tv_sec, (unsigned)tv2.tv_sec);
 				(unsigned)tv1.tv_sec, (unsigned)tv2.tv_sec);
-	else if ((tv1.tv_usec > tv2.tv_usec) && 
+	else if ((tv1.tv_usec > tv2.tv_usec) &&
 				(unsigned)(tv1.tv_usec-tv2.tv_usec)>100000)
 				(unsigned)(tv1.tv_usec-tv2.tv_usec)>100000)
 		BUG("gettimeofday usecs > ser_gettimeofday with > 0.1s : %d ms\n",
 		BUG("gettimeofday usecs > ser_gettimeofday with > 0.1s : %d ms\n",
 			(unsigned)(tv1.tv_usec-tv2.tv_usec)/1000);
 			(unsigned)(tv1.tv_usec-tv2.tv_usec)/1000);
-	else if ((tv1.tv_usec < tv2.tv_usec) && 
+	else if ((tv1.tv_usec < tv2.tv_usec) &&
 				(unsigned)(tv2.tv_usec-tv1.tv_usec)>100000)
 				(unsigned)(tv2.tv_usec-tv1.tv_usec)>100000)
 		BUG("gettimeofday usecs < ser_gettimeofday with > 0.1s : %d ms\n",
 		BUG("gettimeofday usecs < ser_gettimeofday with > 0.1s : %d ms\n",
 			(unsigned)(tv2.tv_usec-tv1.tv_usec)/1000);
 			(unsigned)(tv2.tv_usec-tv1.tv_usec)/1000);
@@ -555,7 +555,7 @@ int timer_add_safe(struct timer_ln* tl, ticks_t delta)
 #endif
 #endif
 {
 {
 	int ret;
 	int ret;
-	
+
 	LOCK_TIMER_LIST();
 	LOCK_TIMER_LIST();
 	if (tl->flags & F_TIMER_ACTIVE){
 	if (tl->flags & F_TIMER_ACTIVE){
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
@@ -600,7 +600,7 @@ error:
 
 
 /* safe timer delete
 /* safe timer delete
  * deletes tl and inits the list pointer to 0
  * deletes tl and inits the list pointer to 0
- * returns  <0 on error (-1 if timer not active/already deleted and -2 if 
+ * returns  <0 on error (-1 if timer not active/already deleted and -2 if
  *           delete attempted from the timer handler) and 0 on success
  *           delete attempted from the timer handler) and 0 on success
  */
  */
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
@@ -611,7 +611,7 @@ int timer_del_safe(struct timer_ln* tl)
 #endif
 #endif
 {
 {
 	int ret;
 	int ret;
-	
+
 	ret=-1;
 	ret=-1;
 again:
 again:
 	/* quick exit if timer inactive */
 	/* quick exit if timer inactive */
@@ -656,7 +656,7 @@ again:
 						", last from: %s(%s):%d, deleted %d times"
 						", last from: %s(%s):%d, deleted %d times"
 						", last from: %s(%s):%d, init %d times, expired %d \n",
 						", last from: %s(%s):%d, init %d times, expired %d \n",
 						tl->add_calls, tl->add_func, tl->add_file,
 						tl->add_calls, tl->add_func, tl->add_file,
-						tl->add_line, tl->del_calls, tl->del_func, 
+						tl->add_line, tl->del_calls, tl->del_func,
 						tl->del_file, tl->del_line, tl->init, tl->expires_no);
 						tl->del_file, tl->del_line, tl->init, tl->expires_no);
 #endif
 #endif
 					return -2; /* do nothing */
 					return -2; /* do nothing */
@@ -680,7 +680,7 @@ again:
 							"already detached\n",
 							"already detached\n",
 							tl, tl->next, tl->prev, tl->flags);
 							tl, tl->next, tl->prev, tl->flags);
 				LOG(timerlog, "WARN: -timer_del-: @%d tl=%p "
 				LOG(timerlog, "WARN: -timer_del-: @%d tl=%p "
-					"{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(), 
+					"{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(),
 					tl,  tl->next, tl->prev, tl->expire, tl->initial_timeout,
 					tl,  tl->next, tl->prev, tl->expire, tl->initial_timeout,
 					tl->data, tl->f, tl->flags);
 					tl->data, tl->f, tl->flags);
 				LOG(timerlog, "WARN: -timer_del-; called from %s(%s):%d\n",
 				LOG(timerlog, "WARN: -timer_del-; called from %s(%s):%d\n",
@@ -726,7 +726,7 @@ again:
 						", last from: %s(%s):%d, deleted %d times"
 						", last from: %s(%s):%d, deleted %d times"
 						", last from: %s(%s):%d, init %d times, expired %d \n",
 						", last from: %s(%s):%d, init %d times, expired %d \n",
 						tl->add_calls, tl->add_func, tl->add_file,
 						tl->add_calls, tl->add_func, tl->add_file,
-						tl->add_line, tl->del_calls, tl->del_func, 
+						tl->add_line, tl->del_calls, tl->del_func,
 						tl->del_file, tl->del_line, tl->init, tl->expires_no);
 						tl->del_file, tl->del_line, tl->init, tl->expires_no);
 #endif
 #endif
 					return -2; /* do nothing */
 					return -2; /* do nothing */
@@ -750,7 +750,7 @@ again:
 							"already detached\n",
 							"already detached\n",
 							tl, tl->next, tl->prev, tl->flags);
 							tl, tl->next, tl->prev, tl->flags);
 				LOG(timerlog, "WARN: -timer_del-: @%d tl=%p "
 				LOG(timerlog, "WARN: -timer_del-: @%d tl=%p "
-					"{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(), 
+					"{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(),
 					tl,  tl->next, tl->prev, tl->expire, tl->initial_timeout,
 					tl,  tl->next, tl->prev, tl->expire, tl->initial_timeout,
 					tl->data, tl->f, tl->flags);
 					tl->data, tl->f, tl->flags);
 				LOG(timerlog, "WARN: -timer_del-; called from %s(%s):%d\n",
 				LOG(timerlog, "WARN: -timer_del-; called from %s(%s):%d\n",
@@ -782,10 +782,10 @@ return ret;
 
 
 
 
 /* marks a timer as "to be deleted when the handler ends", usefull when
 /* marks a timer as "to be deleted when the handler ends", usefull when
- * the timer handler knows it won't prolong the timer anymore (it will 
+ * the timer handler knows it won't prolong the timer anymore (it will
  * return 0) and will do some time consuming work. Calling this function
  * return 0) and will do some time consuming work. Calling this function
- * will cause simultaneous timer_dels to return immediately (they won't 
- * wait anymore for the timer handle to finish). It will also allow 
+ * will cause simultaneous timer_dels to return immediately (they won't
+ * wait anymore for the timer handle to finish). It will also allow
  * self-deleting from the timer handle without bug reports.
  * self-deleting from the timer handle without bug reports.
  * WARNING: - if you rely on timer_del to know when the timer handle execution
  * WARNING: - if you rely on timer_del to know when the timer handle execution
  *            finishes (e.g. to free resources used in the timer handle), don't
  *            finishes (e.g. to free resources used in the timer handle), don't
@@ -802,7 +802,7 @@ void timer_allow_del(void)
 #ifdef USE_SLOW_TIMER
 #ifdef USE_SLOW_TIMER
 	if (IS_IN_TIMER_SLOW()){
 	if (IS_IN_TIMER_SLOW()){
 			UNSET_RUNNING_SLOW();
 			UNSET_RUNNING_SLOW();
-	}else 
+	}else
 #endif
 #endif
 		LM_CRIT("timer_allow_del called outside a timer handle\n");
 		LM_CRIT("timer_allow_del called outside a timer handle\n");
 }
 }
@@ -824,10 +824,10 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
 	struct timer_ln* first;
 	struct timer_ln* first;
 	int i=0;
 	int i=0;
-	
+
 	first=h->next;
 	first=h->next;
 #endif
 #endif
-	
+
 	/*LM_DBG("@ ticks = %lu, list =%p\n",
 	/*LM_DBG("@ ticks = %lu, list =%p\n",
 			(unsigned long) *ticks, h);
 			(unsigned long) *ticks, h);
 	*/
 	*/
@@ -841,9 +841,9 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h
 		}else if((tl->next==0) || (tl->prev==0)){
 		}else if((tl->next==0) || (tl->prev==0)){
 			LM_CRIT("timer_list_expire: @%d tl=%p "
 			LM_CRIT("timer_list_expire: @%d tl=%p "
 					"{ %p, %p, %d, %d, %p, %p, %04x, -},"
 					"{ %p, %p, %d, %d, %p, %p, %04x, -},"
-					" h=%p {%p, %p}\n", t, 
+					" h=%p {%p, %p}\n", t,
 					tl,  tl->next, tl->prev, tl->expire, tl->initial_timeout,
 					tl,  tl->next, tl->prev, tl->expire, tl->initial_timeout,
-					tl->data, tl->f, tl->flags, 
+					tl->data, tl->f, tl->flags,
 					h, h->next, h->prev);
 					h, h->next, h->prev);
 			LM_CRIT("-timer_list_expire-: cycle %d, first %p,"
 			LM_CRIT("-timer_list_expire-: cycle %d, first %p,"
 						"running %p\n", i, first, *running_timer);
 						"running %p\n", i, first, *running_timer);
@@ -869,7 +869,7 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
 			tl->expires_no++;
 			tl->expires_no++;
 #endif
 #endif
-			UNLOCK_TIMER_LIST(); /* acts also as write barrier */ 
+			UNLOCK_TIMER_LIST(); /* acts also as write barrier */
 				ret=tl->f(t, tl, tl->data);
 				ret=tl->f(t, tl, tl->data);
 				/* reset the configuration group handles */
 				/* reset the configuration group handles */
 				cfg_reset_all();
 				cfg_reset_all();
@@ -891,7 +891,7 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h
 			tl->slow_idx=slow_mark; /* current index */
 			tl->slow_idx=slow_mark; /* current index */
 			/* overflow check in timer_handler*/
 			/* overflow check in timer_handler*/
 			_timer_add_list(slow_l, tl);
 			_timer_add_list(slow_l, tl);
-			
+
 		}
 		}
 #endif
 #endif
 	}
 	}
@@ -909,11 +909,11 @@ static void timer_handler(void)
 #ifdef USE_SLOW_TIMER
 #ifdef USE_SLOW_TIMER
 	int run_slow_timer;
 	int run_slow_timer;
 	int i;
 	int i;
-	
+
 	run_slow_timer=0;
 	run_slow_timer=0;
 	i=(slow_idx_t)(*t_idx%SLOW_LISTS_NO);
 	i=(slow_idx_t)(*t_idx%SLOW_LISTS_NO);
 #endif
 #endif
-	
+
 	/*LM_DBG("called, ticks=%lu, prev_ticks=%lu\n",
 	/*LM_DBG("called, ticks=%lu, prev_ticks=%lu\n",
 			(unsigned long)*ticks, (unsigned long)prev_ticks);
 			(unsigned long)*ticks, (unsigned long)prev_ticks);
 	*/
 	*/
@@ -930,7 +930,7 @@ static void timer_handler(void)
 		}
 		}
 		/* go through all the "missed" ticks, taking a possible overflow
 		/* go through all the "missed" ticks, taking a possible overflow
 		 * into account */
 		 * into account */
-		for (prev_ticks=prev_ticks+1; prev_ticks!=saved_ticks; prev_ticks++) 
+		for (prev_ticks=prev_ticks+1; prev_ticks!=saved_ticks; prev_ticks++)
 			timer_run(prev_ticks);
 			timer_run(prev_ticks);
 		timer_run(prev_ticks); /* do it for saved_ticks too */
 		timer_run(prev_ticks); /* do it for saved_ticks too */
 	}while(saved_ticks!=*ticks); /* in case *ticks changed */
 	}while(saved_ticks!=*ticks); /* in case *ticks changed */
@@ -987,7 +987,7 @@ static ticks_t compat_old_handler(ticks_t ti, struct timer_ln* tl,
 									void * data)
 									void * data)
 {
 {
 	struct sr_timer* t;
 	struct sr_timer* t;
-	
+
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
 	LM_DBG("calling, ticks=%u/%u, tl=%p, t=%p\n",
 	LM_DBG("calling, ticks=%u/%u, tl=%p, t=%p\n",
 			prev_ticks, (unsigned)*ticks, tl, data);
 			prev_ticks, (unsigned)*ticks, tl, data);
@@ -1002,7 +1002,7 @@ static ticks_t compat_old_handler(ticks_t ti, struct timer_ln* tl,
 /* register a periodic timer;
 /* register a periodic timer;
  * compatibility mode.w/ the old timer interface...
  * compatibility mode.w/ the old timer interface...
  * ret: <0 on error
  * ret: <0 on error
- * Hint: if you need it in a module, register it from mod_init or it 
+ * Hint: if you need it in a module, register it from mod_init or it
  * won't work otherwise*/
  * won't work otherwise*/
 int register_timer(timer_function f, void* param, unsigned int interval)
 int register_timer(timer_function f, void* param, unsigned int interval)
 {
 {
@@ -1016,13 +1016,13 @@ int register_timer(timer_function f, void* param, unsigned int interval)
 	t->id=timer_id++;
 	t->id=timer_id++;
 	t->timer_f=f;
 	t->timer_f=f;
 	t->t_param=param;
 	t->t_param=param;
-	
+
 	timer_init(&t->tl, compat_old_handler, t, 0); /* is slow */
 	timer_init(&t->tl, compat_old_handler, t, 0); /* is slow */
 	if (timer_add(&t->tl, S_TO_TICKS(interval))!=0){
 	if (timer_add(&t->tl, S_TO_TICKS(interval))!=0){
 		LM_ERR("timer_add failed\n");
 		LM_ERR("timer_add failed\n");
 		return -1;
 		return -1;
 	}
 	}
-	
+
 	return t->id;
 	return t->id;
 
 
 error:
 error:
@@ -1083,7 +1083,7 @@ void slow_timer_main()
 #ifdef USE_SIGWAIT
 #ifdef USE_SIGWAIT
 	int sig;
 	int sig;
 #endif
 #endif
-	
+
 	in_slow_timer=1; /* mark this process as the slow timer */
 	in_slow_timer=1; /* mark this process as the slow timer */
 	while(1){
 	while(1){
 #ifdef USE_SIGWAIT
 #ifdef USE_SIGWAIT
@@ -1101,11 +1101,11 @@ void slow_timer_main()
 	if (sig!=SLOW_TIMER_SIG){
 	if (sig!=SLOW_TIMER_SIG){
 #ifdef __OS_darwin
 #ifdef __OS_darwin
 		/* on darwin sigwait is buggy: it will cause extreme slow down
 		/* on darwin sigwait is buggy: it will cause extreme slow down
-		   on signal delivery for the signals it doesn't wait on
-		   (on darwin 8.8.0, g4 1.5Ghz I've measured a 36s delay!).
-		  To work arround this bug, we sigwait() on all the signals we
-		  are interested in ser and manually call the master signal handler 
-		  if the signal!= slow timer signal -- andrei */
+		 *  on signal delivery for the signals it doesn't wait on
+		 *  (on darwin 8.8.0, g4 1.5Ghz I've measured a 36s delay!).
+		 * To work arround this bug, we sigwait() on all the signals we
+		 * are interested in ser and manually call the master signal handler
+		 * if the signal!= slow timer signal -- andrei */
 		sig_usr(sig);
 		sig_usr(sig);
 #endif
 #endif
 		continue;
 		continue;
@@ -1113,7 +1113,7 @@ void slow_timer_main()
 #endif
 #endif
 		/* update the local cfg if needed */
 		/* update the local cfg if needed */
 		cfg_update();
 		cfg_update();
-		
+
 		LOCK_SLOW_TIMER_LIST();
 		LOCK_SLOW_TIMER_LIST();
 		while(*s_idx!=*t_idx){
 		while(*s_idx!=*t_idx){
 			i= *s_idx%SLOW_LISTS_NO;
 			i= *s_idx%SLOW_LISTS_NO;
@@ -1150,7 +1150,7 @@ void slow_timer_main()
 		}
 		}
 		UNLOCK_SLOW_TIMER_LIST();
 		UNLOCK_SLOW_TIMER_LIST();
 	}
 	}
-	
+
 }
 }
 
 
 #endif
 #endif

+ 14 - 14
timer.h

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 /**
 /**
@@ -41,8 +41,8 @@
 #ifndef timer_h
 #ifndef timer_h
 #define timer_h
 #define timer_h
 
 
-#define USE_SLOW_TIMER /* use another process to run the timer handlers 
-						  marked "slow" */
+#define USE_SLOW_TIMER /* use another process to run the timer handlers
+						*  marked "slow" */
 /*#define TIMER_DEBUG -- compile with -DTIMER_DEBUG*/
 /*#define TIMER_DEBUG -- compile with -DTIMER_DEBUG*/
 
 
 #include "clist.h"
 #include "clist.h"
@@ -62,7 +62,7 @@ extern pid_t slow_timer_pid;
 
 
 /* deprecated, old, kept for compatibility */
 /* deprecated, old, kept for compatibility */
 typedef void (timer_function)(unsigned int ticks, void* param);
 typedef void (timer_function)(unsigned int ticks, void* param);
-/* deprecated, old, kept for compatibility 
+/* deprecated, old, kept for compatibility
 	get_ticks()*TIMER_TICK used to be the time in s
 	get_ticks()*TIMER_TICK used to be the time in s
 	for new code, use get_ticks_raw() and one of the macros defined in
 	for new code, use get_ticks_raw() and one of the macros defined in
 	timer_ticks.h (.e.g TICKS_TO_S(tick) to convert to s or ms )*/
 	timer_ticks.h (.e.g TICKS_TO_S(tick) to convert to s or ms )*/
@@ -72,7 +72,7 @@ typedef void (timer_function)(unsigned int ticks, void* param);
 typedef void (utimer_function)(unsigned int uticks, void* param);
 typedef void (utimer_function)(unsigned int uticks, void* param);
 
 
 struct timer_ln; /* forward decl */
 struct timer_ln; /* forward decl */
-/* new 
+/* new
  * params:
  * params:
  *         - handle pointer to the corresponding struct timer_ln
  *         - handle pointer to the corresponding struct timer_ln
  * return: 0 if the timer is one shot, new expire interval if not, -1
  * return: 0 if the timer is one shot, new expire interval if not, -1
@@ -89,19 +89,19 @@ typedef ticks_t (timer_handler_f)(ticks_t t, struct timer_ln* tl,
 /* timer flags */
 /* timer flags */
 #define F_TIMER_FAST	1
 #define F_TIMER_FAST	1
 #define F_TIMER_ON_SLOW_LIST	0x100
 #define F_TIMER_ON_SLOW_LIST	0x100
-#define F_TIMER_ACTIVE	0x200 /* timer is running or has run and expired
-								 (one shot) */
+#define F_TIMER_ACTIVE	0x200	/* timer is running or has run and expired
+								 * (one shot) */
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
-#define F_TIMER_DELETED	0x400 
+#define F_TIMER_DELETED	0x400
 #endif
 #endif
 
 
 struct timer_ln{ /* timer_link already used in tm */
 struct timer_ln{ /* timer_link already used in tm */
 	struct timer_ln* next;
 	struct timer_ln* next;
 	struct timer_ln* prev;
 	struct timer_ln* prev;
-	ticks_t expire; 
+	ticks_t expire;
 	ticks_t initial_timeout;
 	ticks_t initial_timeout;
 	void* data;
 	void* data;
-	timer_handler_f* f; 
+	timer_handler_f* f;
 	volatile unsigned short flags;
 	volatile unsigned short flags;
 #ifdef USE_SLOW_TIMER
 #ifdef USE_SLOW_TIMER
 	volatile slow_idx_t slow_idx;
 	volatile slow_idx_t slow_idx;
@@ -145,14 +145,14 @@ void timer_free(struct timer_ln* t);
 #define timer_reinit(tl) \
 #define timer_reinit(tl) \
 	do{ \
 	do{ \
 		(tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \
 		(tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \
-											  F_TIMER_ACTIVE));\
+											F_TIMER_ACTIVE));\
 		(tl)->init++; \
 		(tl)->init++; \
 	}while(0)
 	}while(0)
 #else
 #else
 /* use for a deleted/expired timer that you want to add again */
 /* use for a deleted/expired timer that you want to add again */
 #define timer_reinit(tl) \
 #define timer_reinit(tl) \
 	(tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \
 	(tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \
-										  F_TIMER_ACTIVE))
+										F_TIMER_ACTIVE))
 #endif
 #endif
 
 
 #define timer_init(tl, fun, param, flgs) \
 #define timer_init(tl, fun, param, flgs) \
@@ -165,7 +165,7 @@ void timer_free(struct timer_ln* t);
 	}while(0)
 	}while(0)
 
 
 #ifdef TIMER_DEBUG
 #ifdef TIMER_DEBUG
-int timer_add_safe(struct timer_ln *tl, ticks_t delta, 
+int timer_add_safe(struct timer_ln *tl, ticks_t delta,
 					const char*, const char*, unsigned);
 					const char*, const char*, unsigned);
 int timer_del_safe(struct timer_ln *tl,
 int timer_del_safe(struct timer_ln *tl,
 					const char*, const char*, unsigned);
 					const char*, const char*, unsigned);

+ 9 - 9
timer_funcs.h

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 
 
@@ -58,7 +58,7 @@ struct timer_head{
 /*@{ */
 /*@{ */
 
 
 #define H0_BITS 14
 #define H0_BITS 14
-#define H1_BITS  9 
+#define H1_BITS  9
 #define H2_BITS  (32-H1_BITS-H0_BITS)
 #define H2_BITS  (32-H1_BITS-H0_BITS)
 
 
 
 
@@ -139,7 +139,7 @@ static inline void timer_redist(ticks_t t, struct timer_head *h)
 {
 {
 	struct timer_ln* tl;
 	struct timer_ln* tl;
 	struct timer_ln* tmp;
 	struct timer_ln* tmp;
-	
+
 	timer_foreach_safe(tl, tmp, h){
 	timer_foreach_safe(tl, tmp, h){
 		_timer_dist_tl(tl, tl->expire-t);
 		_timer_dist_tl(tl, tl->expire-t);
 	}
 	}
@@ -156,7 +156,7 @@ static inline void timer_run(ticks_t t)
 		if ((t & H1_H0_MASK)==0){        /*r2*/
 		if ((t & H1_H0_MASK)==0){        /*r2*/
 			timer_redist(t, &timer_lst->h2[t>>(H0_BITS+H1_BITS)]);
 			timer_redist(t, &timer_lst->h2[t>>(H0_BITS+H1_BITS)]);
 		}
 		}
-		
+
 		timer_redist(t, &timer_lst->h1[(t & H1_H0_MASK)>>H0_BITS]);/*r2 >> H0*/
 		timer_redist(t, &timer_lst->h1[(t & H1_H0_MASK)>>H0_BITS]);/*r2 >> H0*/
 	}
 	}
 	/*
 	/*
@@ -171,7 +171,7 @@ static inline void timer_lst_mv0(ticks_t t, struct timer_head* h)
 {
 {
 	struct timer_ln* tl;
 	struct timer_ln* tl;
 	struct timer_ln* tmp;
 	struct timer_ln* tmp;
-	
+
 	timer_foreach_safe(tl, tmp, h){
 	timer_foreach_safe(tl, tmp, h){
 			_timer_dist_tl(tl, &timer_lst->h0[tl->expire & H0_MASK]);
 			_timer_dist_tl(tl, &timer_lst->h0[tl->expire & H0_MASK]);
 	}
 	}
@@ -183,12 +183,12 @@ static inline void timer_lst_mv1(ticks_t t, struct timer_head* h)
 {
 {
 	struct timer_ln* tl;
 	struct timer_ln* tl;
 	struct timer_ln* tmp;
 	struct timer_ln* tmp;
-	
+
 	timer_foreach_safe(tl, tmp, h){
 	timer_foreach_safe(tl, tmp, h){
 		if ((tl->expire & H0_MASK)==0) /* directly to h0 */
 		if ((tl->expire & H0_MASK)==0) /* directly to h0 */
 			_timer_add_list(tl, &timer_lst->h0[tl->expire & H0_MASK]);
 			_timer_add_list(tl, &timer_lst->h0[tl->expire & H0_MASK]);
 		else  /* to h1 */
 		else  /* to h1 */
-			_timer_add_list(tl, 
+			_timer_add_list(tl,
 						&timer_lst->h1[(tl->expire & H1_H0_MASK)>>H0_BITS]);
 						&timer_lst->h1[(tl->expire & H1_H0_MASK)>>H0_BITS]);
 	}
 	}
 	/* clear the current list */
 	/* clear the current list */
@@ -203,7 +203,7 @@ static inline void timer_run(ticks_t t)
 	if ((t & H0_MASK)==0){              /*r1*/
 	if ((t & H0_MASK)==0){              /*r1*/
 		if ((t & H1_H0_MASK)==0)        /*r2*/
 		if ((t & H1_H0_MASK)==0)        /*r2*/
 			/* just move the list "down" to hash1 */
 			/* just move the list "down" to hash1 */
-			timer_lst_mv1(&timer_lst->h2[t>>(H0_BITS+H1_BITS)]); 
+			timer_lst_mv1(&timer_lst->h2[t>>(H0_BITS+H1_BITS)]);
 		/* move "down" to hash0 */
 		/* move "down" to hash0 */
 		timer_lst_mv0(&timer_lst->h1[(t & H1_H0_MASK)>>H0_BITS]);
 		timer_lst_mv0(&timer_lst->h1[(t & H1_H0_MASK)>>H0_BITS]);
 	}
 	}

+ 15 - 15
timer_proc.c

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2009 iptelorg GmbH
  * Copyright (C) 2009 iptelorg GmbH
  *
  *
  * Permission to use, copy, modify, and distribute this software for any
  * Permission to use, copy, modify, and distribute this software for any
@@ -48,8 +48,8 @@ int register_basic_timers(int timers)
 
 
 /**
 /**
  * \brief Forks a separate simple sleep() periodic timer
  * \brief Forks a separate simple sleep() periodic timer
- * 
- * Forks a very basic periodic timer process, that just sleep()s for 
+ *
+ * Forks a very basic periodic timer process, that just sleep()s for
  * the specified interval and then calls the timer function.
  * the specified interval and then calls the timer function.
  * The new "basic timer" process execution start immediately, the sleep()
  * The new "basic timer" process execution start immediately, the sleep()
  * is called first (so the first call to the timer function will happen
  * is called first (so the first call to the timer function will happen
@@ -67,7 +67,7 @@ int fork_basic_timer(int child_id, char* desc, int make_sock,
 						timer_function* f, void* param, int interval)
 						timer_function* f, void* param, int interval)
 {
 {
 	int pid;
 	int pid;
-	
+
 	pid=fork_process(child_id, desc, make_sock);
 	pid=fork_process(child_id, desc, make_sock);
 	if (pid<0) return -1;
 	if (pid<0) return -1;
 	if (pid==0){
 	if (pid==0){
@@ -77,7 +77,7 @@ int fork_basic_timer(int child_id, char* desc, int make_sock,
 			sleep(interval);
 			sleep(interval);
 			cfg_update();
 			cfg_update();
 			f(get_ticks(), param); /* ticks in s for compatibility with old
 			f(get_ticks(), param); /* ticks in s for compatibility with old
-									  timers */
+									* timers */
 		}
 		}
 	}
 	}
 	/* parent */
 	/* parent */
@@ -86,8 +86,8 @@ int fork_basic_timer(int child_id, char* desc, int make_sock,
 
 
 /**
 /**
  * \brief Forks a separate simple microsecond-sleep() periodic timer
  * \brief Forks a separate simple microsecond-sleep() periodic timer
- * 
- * Forks a very basic periodic timer process, that just us-sleep()s for 
+ *
+ * Forks a very basic periodic timer process, that just us-sleep()s for
  * the specified interval and then calls the timer function.
  * the specified interval and then calls the timer function.
  * The new "basic timer" process execution start immediately, the us-sleep()
  * The new "basic timer" process execution start immediately, the us-sleep()
  * is called first (so the first call to the timer function will happen
  * is called first (so the first call to the timer function will happen
@@ -106,7 +106,7 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock,
 {
 {
 	int pid;
 	int pid;
 	ticks_t ts;
 	ticks_t ts;
-	
+
 	pid=fork_process(child_id, desc, make_sock);
 	pid=fork_process(child_id, desc, make_sock);
 	if (pid<0) return -1;
 	if (pid<0) return -1;
 	if (pid==0){
 	if (pid==0){
@@ -126,7 +126,7 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock,
 
 
 /**
 /**
  * \brief Forks a timer process based on the local timer
  * \brief Forks a timer process based on the local timer
- * 
+ *
  * Forks a separate timer process running a local_timer.h type of timer
  * Forks a separate timer process running a local_timer.h type of timer
  * A pointer to the local_timer handle (allocated in shared memory) is
  * A pointer to the local_timer handle (allocated in shared memory) is
  * returned in lt_h. It can be used to add/delete more timers at runtime
  * returned in lt_h. It can be used to add/delete more timers at runtime
@@ -135,10 +135,10 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock,
  * used (all the calls to local_timer* must be enclosed by locks if it
  * used (all the calls to local_timer* must be enclosed by locks if it
  * cannot be guaranteed that they cannot execute in the same time)
  * cannot be guaranteed that they cannot execute in the same time)
  * The timer "engine" must be run manually from the child process. For
  * The timer "engine" must be run manually from the child process. For
- * example a very simple local timer process that just runs a single 
+ * example a very simple local timer process that just runs a single
  * periodic timer can be started in the following way:
  * periodic timer can be started in the following way:
  * struct local_timer* lt_h;
  * struct local_timer* lt_h;
- * 
+ *
  * pid=fork_local_timer_process(...., &lt_h);
  * pid=fork_local_timer_process(...., &lt_h);
  * if (pid==0){
  * if (pid==0){
  *          timer_init(&my_timer, my_timer_f, 0, 0);
  *          timer_init(&my_timer, my_timer_f, 0, 0);
@@ -157,7 +157,7 @@ int fork_local_timer_process(int child_id, char* desc, int make_sock,
 {
 {
 	int pid;
 	int pid;
 	struct local_timer* lt;
 	struct local_timer* lt;
-	
+
 	lt=shm_malloc(sizeof(*lt));
 	lt=shm_malloc(sizeof(*lt));
 	if (lt==0) goto error;
 	if (lt==0) goto error;
 	if (init_local_timer(lt, get_ticks_raw())<0) goto error;
 	if (init_local_timer(lt, get_ticks_raw())<0) goto error;
@@ -186,7 +186,7 @@ int register_sync_timers(int timers)
 /**
 /**
  * \brief Forks a separate simple sleep() -&- sync periodic timer
  * \brief Forks a separate simple sleep() -&- sync periodic timer
  *
  *
- * Forks a very basic periodic timer process, that just sleep()s for 
+ * Forks a very basic periodic timer process, that just sleep()s for
  * the specified interval and then calls the timer function.
  * the specified interval and then calls the timer function.
  * The new "sync timer" process execution start immediately, the sleep()
  * The new "sync timer" process execution start immediately, the sleep()
  * is called first (so the first call to the timer function will happen
  * is called first (so the first call to the timer function will happen
@@ -222,7 +222,7 @@ int fork_sync_timer(int child_id, char* desc, int make_sock,
 			ts1 = get_ticks_raw();
 			ts1 = get_ticks_raw();
 			cfg_update();
 			cfg_update();
 			f(TICKS_TO_S(ts1), param); /* ticks in sec for compatibility with old
 			f(TICKS_TO_S(ts1), param); /* ticks in sec for compatibility with old
-									  timers */
+										* timers */
 			/* adjust the next sleep duration */
 			/* adjust the next sleep duration */
 			ts2 = interval - TICKS_TO_MS(get_ticks_raw()) + TICKS_TO_MS(ts1);
 			ts2 = interval - TICKS_TO_MS(get_ticks_raw()) + TICKS_TO_MS(ts1);
 		}
 		}
@@ -235,7 +235,7 @@ int fork_sync_timer(int child_id, char* desc, int make_sock,
 /**
 /**
  * \brief Forks a separate simple microsecond-sleep() -&- sync periodic timer
  * \brief Forks a separate simple microsecond-sleep() -&- sync periodic timer
  *
  *
- * Forks a very basic periodic timer process, that just us-sleep()s for 
+ * Forks a very basic periodic timer process, that just us-sleep()s for
  * the specified interval and then calls the timer function.
  * the specified interval and then calls the timer function.
  * The new "sync timer" process execution start immediately, the us-sleep()
  * The new "sync timer" process execution start immediately, the us-sleep()
  * is called first (so the first call to the timer function will happen
  * is called first (so the first call to the timer function will happen

+ 8 - 8
timer_proc.h

@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2009 iptelorg GmbH
  * Copyright (C) 2009 iptelorg GmbH
  *
  *
  * Permission to use, copy, modify, and distribute this software for any
  * Permission to use, copy, modify, and distribute this software for any
@@ -41,8 +41,8 @@ int register_basic_timers(int timers);
 
 
 /**
 /**
  * \brief Forks a separate simple sleep() periodic timer
  * \brief Forks a separate simple sleep() periodic timer
- * 
- * Forks a very basic periodic timer process, that just sleep()s for 
+ *
+ * Forks a very basic periodic timer process, that just sleep()s for
  * the specified interval and then calls the timer function.
  * the specified interval and then calls the timer function.
  * The new "basic timer" process execution start immediately, the sleep()
  * The new "basic timer" process execution start immediately, the sleep()
  * is called first (so the first call to the timer function will happen
  * is called first (so the first call to the timer function will happen
@@ -63,8 +63,8 @@ int fork_basic_timer(int child_id, char* desc, int make_sock,
 
 
 /**
 /**
  * \brief Forks a separate simple milisecond-sleep() periodic timer
  * \brief Forks a separate simple milisecond-sleep() periodic timer
- * 
- * Forks a very basic periodic timer process, that just ms-sleep()s for 
+ *
+ * Forks a very basic periodic timer process, that just ms-sleep()s for
  * the specified interval and then calls the timer function.
  * the specified interval and then calls the timer function.
  * The new "basic timer" process execution start immediately, the ms-sleep()
  * The new "basic timer" process execution start immediately, the ms-sleep()
  * is called first (so the first call to the timer function will happen
  * is called first (so the first call to the timer function will happen
@@ -82,7 +82,7 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock,
 						timer_function* f, void* param, int uinterval);
 						timer_function* f, void* param, int uinterval);
 /**
 /**
  * \brief Forks a timer process based on the local timer
  * \brief Forks a timer process based on the local timer
- * 
+ *
  * Forks a separate timer process running a local_timer.h type of timer
  * Forks a separate timer process running a local_timer.h type of timer
  * A pointer to the local_timer handle (allocated in shared memory) is
  * A pointer to the local_timer handle (allocated in shared memory) is
  * returned in lt_h. It can be used to add/delete more timers at runtime
  * returned in lt_h. It can be used to add/delete more timers at runtime
@@ -91,10 +91,10 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock,
  * used (all the calls to local_timer* must be enclosed by locks if it
  * used (all the calls to local_timer* must be enclosed by locks if it
  * cannot be guaranteed that they cannot execute in the same time)
  * cannot be guaranteed that they cannot execute in the same time)
  * The timer "engine" must be run manually from the child process. For
  * The timer "engine" must be run manually from the child process. For
- * example a very simple local timer process that just runs a single 
+ * example a very simple local timer process that just runs a single
  * periodic timer can be started in the following way:
  * periodic timer can be started in the following way:
  * struct local_timer* lt_h;
  * struct local_timer* lt_h;
- * 
+ *
  * pid=fork_local_timer_process(...., &lt_h);
  * pid=fork_local_timer_process(...., &lt_h);
  * if (pid==0){
  * if (pid==0){
  *          timer_init(&my_timer, my_timer_f, 0, 0);
  *          timer_init(&my_timer, my_timer_f, 0, 0);

+ 2 - 2
timer_ticks.h

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
  */
 /**
 /**