From 12e90334e0f9c18a7d10911af74266d96dba91f1 Mon Sep 17 00:00:00 2001 From: William Smith Date: Sun, 13 Jan 2013 00:11:01 -0500 Subject: [PATCH] timing: mark alarmed variable volatile Mark "alarmed" global variable as volatile to prevent compiler optimizations around it. --- include/tropicssl/timing.h | 2 +- library/timing.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/tropicssl/timing.h b/include/tropicssl/timing.h index f1677f5..59ed5f2 100644 --- a/include/tropicssl/timing.h +++ b/include/tropicssl/timing.h @@ -46,7 +46,7 @@ struct hr_time { extern "C" { #endif - extern int alarmed; + extern volatile int alarmed; /** * \brief Return the CPU cycle counter value diff --git a/library/timing.c b/library/timing.c index 1746f88..22c1823 100644 --- a/library/timing.c +++ b/library/timing.c @@ -164,7 +164,7 @@ unsigned long hardclock(void) #endif /* AMD64 */ #endif /* i586+ */ -int alarmed = 0; +volatile int alarmed = 0; #if defined(WIN32) -- 2.11.4.GIT