X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Falarm.cc;h=93c8ccf74e14b307fb198041e9ababaca60e0420;hb=6b83fd5838692b71a50710b9bc13680f9c586167;hp=08ac787cf2838b11f2a54d9fc477aa28b09b01e4;hpb=a0a194ba0789e0650329d81a5ed12620360789eb;p=m6w6%2Flibmemcached diff --git a/libtest/alarm.cc b/libtest/alarm.cc index 08ac787c..93c8ccf7 100644 --- a/libtest/alarm.cc +++ b/libtest/alarm.cc @@ -34,7 +34,7 @@ * */ -#include +#include "mem_config.h" #include #include @@ -51,33 +51,42 @@ static const struct itimerval cancel_timer= { default_it_interval, default_it_in void set_alarm() { - if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1) + if (gdb_is_caller() == false) { - Error << "setitimer() failed"; + if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1) + { + Error << "setitimer() failed"; + } } } void set_alarm(long tv_sec, long tv_usec) { + if (gdb_is_caller() == false) + { #if defined(TARGET_OS_OSX) && TARGET_OS_OSX - struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) }; + struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) }; #else - struct timeval it_value= { tv_sec, tv_usec }; + struct timeval it_value= { tv_sec, tv_usec }; #endif - struct itimerval timer= { default_it_interval, it_value }; + struct itimerval timer= { default_it_interval, it_value }; - if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1) - { - Error << "setitimer() failed"; + if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1) + { + Error << "setitimer() failed"; + } } } void cancel_alarm() { - if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1) + if (gdb_is_caller() == false) { - Error << "setitimer() failed"; + if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1) + { + Error << "setitimer() failed"; + } } }