From 1cc61968613a624a892018e8cf38b9ef811ea71b Mon Sep 17 00:00:00 2001 From: zhengshuxin Date: Wed, 9 Aug 2017 11:41:47 +0800 Subject: [PATCH] __end is reserved in g++4.8.x's header --- lib_fiber/samples/redis/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_fiber/samples/redis/main.cpp b/lib_fiber/samples/redis/main.cpp index 09326ec62..8ab06f13c 100644 --- a/lib_fiber/samples/redis/main.cpp +++ b/lib_fiber/samples/redis/main.cpp @@ -4,7 +4,8 @@ static int __fibers_count = 2; static int __fibers_max = 2; static int __oper_count = 100; -static struct timeval __begin, __end; +static struct timeval __begin; +static struct timeval __finish; static void fiber_redis(ACL_FIBER *fiber, void *ctx) { @@ -75,8 +76,8 @@ static void fiber_redis(ACL_FIBER *fiber, void *ctx) if (--__fibers_count == 0) { long long total = __fibers_max * i * 3; - gettimeofday(&__end, NULL); - spent = stamp_sub(&__end, &__begin); + gettimeofday(&__finish, NULL); + spent = stamp_sub(&__finish, &__begin); printf("fibers: %d, count: %lld, spent: %.2f, speed: %.2f\r\n", __fibers_max, total, spent, (total * 1000) / (spent > 0 ? spent : 1));