]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/thread.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / thread.c
index 267dcd1cfce4c72c257ed07effca44ac18d077e3..44c9e2b2f1689d93af58cadd431e4b123fb2709b 100644 (file)
@@ -68,7 +68,7 @@ static unsigned int cpu_record_hash_key(struct cpu_thread_history *a)
        return jhash(&a->func, size, 0);
 }
 
-static int cpu_record_hash_cmp(const struct cpu_thread_history *a,
+static bool cpu_record_hash_cmp(const struct cpu_thread_history *a,
                               const struct cpu_thread_history *b)
 {
        return a->func == b->func;
@@ -434,7 +434,7 @@ struct thread_master *thread_master_create(const char *name)
 
        rv->cpu_record = hash_create_size(
                8, (unsigned int (*)(void *))cpu_record_hash_key,
-               (int (*)(const void *, const void *))cpu_record_hash_cmp,
+               (bool (*)(const void *, const void *))cpu_record_hash_cmp,
                "Thread Hash");
 
 
@@ -655,20 +655,26 @@ void thread_master_free(struct thread_master *m)
        XFREE(MTYPE_THREAD_MASTER, m);
 }
 
-/* Return remain time in second. */
-unsigned long thread_timer_remain_second(struct thread *thread)
+/* Return remain time in miliseconds. */
+unsigned long thread_timer_remain_msec(struct thread *thread)
 {
        int64_t remain;
 
        pthread_mutex_lock(&thread->mtx);
        {
-               remain = monotime_until(&thread->u.sands, NULL) / 1000000LL;
+               remain = monotime_until(&thread->u.sands, NULL) / 1000LL;
        }
        pthread_mutex_unlock(&thread->mtx);
 
        return remain < 0 ? 0 : remain;
 }
 
+/* Return remain time in seconds. */
+unsigned long thread_timer_remain_second(struct thread *thread)
+{
+       return thread_timer_remain_msec(thread) / 1000LL;
+}
+
 #define debugargdef  const char *funcname, const char *schedfrom, int fromln
 #define debugargpass funcname, schedfrom, fromln