--- embedaddon/quagga/lib/thread.h 2012/02/21 17:26:12 1.1.1.1 +++ embedaddon/quagga/lib/thread.h 2013/07/21 23:54:39 1.1.1.3 @@ -1,5 +1,6 @@ /* Thread management routine header. * Copyright (C) 1998 Kunihiro Ishiguro + * Portions Copyright (c) 2008 Everton da Silva Marques * * This file is part of GNU Zebra. * @@ -22,6 +23,8 @@ #ifndef _ZEBRA_THREAD_H #define _ZEBRA_THREAD_H +#include + struct rusage_t { #ifdef HAVE_RUSAGE @@ -59,6 +62,9 @@ struct thread_master typedef unsigned char thread_type; +/* ISO C99 maximum function name length is 63 */ +#define FUNCNAME_LEN 64 + /* Thread itself. */ struct thread { @@ -74,15 +80,14 @@ struct thread int fd; /* file descriptor in case of read/write. */ struct timeval sands; /* rest of time sands value. */ } u; - RUSAGE_T ru; /* Indepth usage info. */ + struct timeval real; struct cpu_thread_history *hist; /* cache pointer to cpu_history */ - char* funcname; + char funcname[FUNCNAME_LEN]; }; struct cpu_thread_history { int (*func)(struct thread *); - char *funcname; unsigned int total_calls; struct time_stats { @@ -92,6 +97,7 @@ struct cpu_thread_history struct time_stats cpu; #endif thread_type types; + char funcname[FUNCNAME_LEN]; }; /* Clocks supported by Quagga */ @@ -135,6 +141,12 @@ enum quagga_clkid { do { \ if (! thread) \ thread = thread_add_timer (master, func, arg, time); \ + } while (0) + +#define THREAD_TIMER_MSEC_ON(master,thread,func,arg,time) \ + do { \ + if (! thread) \ + thread = thread_add_timer_msec (master, func, arg, time); \ } while (0) #define THREAD_OFF(thread) \