Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- utils/cpucycle.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/utils/cpucycle.c b/utils/cpucycle.c index 5ad36bc..f896815 100644 --- a/utils/cpucycle.c +++ b/utils/cpucycle.c @@ -35,11 +35,11 @@ #include <sys/time.h> #include <sys/resource.h>
-static bool intr; +volatile sig_atomic_t intr = 0;
void sigalarm(int sig) { - intr = true; + intr = 1; }
int main(int argc, char *argv[]) @@ -97,10 +97,10 @@ int main(int argc, char *argv[])
/* warmup */ alarm(1); - for (counter = 0, intr = false; !intr ; counter++); + for (counter = 0, intr = 0; !intr ; counter++);
alarm(1); - for (counter = 0, intr = false; !intr ; counter++); + for (counter = 0, intr = 0; !intr ; counter++);
printf("%ld\n", counter);
Merged.
On 12 July 2012 16:52, Daniel Lezcano daniel.lezcano@linaro.org wrote:
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org
utils/cpucycle.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/utils/cpucycle.c b/utils/cpucycle.c index 5ad36bc..f896815 100644 --- a/utils/cpucycle.c +++ b/utils/cpucycle.c @@ -35,11 +35,11 @@ #include <sys/time.h> #include <sys/resource.h>
-static bool intr; +volatile sig_atomic_t intr = 0;
void sigalarm(int sig) {
intr = true;
intr = 1;
}
int main(int argc, char *argv[]) @@ -97,10 +97,10 @@ int main(int argc, char *argv[])
/* warmup */ alarm(1);
for (counter = 0, intr = false; !intr ; counter++);
for (counter = 0, intr = 0; !intr ; counter++); alarm(1);
for (counter = 0, intr = false; !intr ; counter++);
for (counter = 0, intr = 0; !intr ; counter++); printf("%ld\n", counter);
-- 1.7.5.4