From 5e6233ab6956b33984e61141e2976d7c1881516c Mon Sep 17 00:00:00 2001 From: yuqing Date: Wed, 8 Oct 2014 16:58:25 +0800 Subject: [PATCH] sched_thread.c: calculate next_call_time correctly --- HISTORY | 2 ++ libfastcommon.spec | 2 +- src/sched_thread.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 739ef3b..b04497c 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,5 @@ +Version 1.08 2014-10-08 + * sched_thread.c: calculate next_call_time correctly Version 1.07 2014-09-16 * increment alloc task buffer diff --git a/libfastcommon.spec b/libfastcommon.spec index 9807629..8d3f193 100644 --- a/libfastcommon.spec +++ b/libfastcommon.spec @@ -1,5 +1,5 @@ Name: libfastcommon -Version: 1.0.7 +Version: 1.0.8 Release: 1%{?dist} Summary: c common functions library extracted from my open source projects FastDFS License: GPL diff --git a/src/sched_thread.c b/src/sched_thread.c index 58f67f5..7dbb8a8 100644 --- a/src/sched_thread.c +++ b/src/sched_thread.c @@ -320,8 +320,10 @@ static void *sched_thread_entrance(void *args) { //fprintf(stderr, "exec task id=%d\n", pCurrent->id); pCurrent->task_func(pCurrent->func_args); - pCurrent->next_call_time = g_current_time + \ - pCurrent->interval; + do + { + pCurrent->next_call_time += pCurrent->interval; + } while (pCurrent->next_call_time <= g_current_time); pCurrent = pCurrent->next; exec_count++; }