summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-23 16:53:13 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-23 16:53:13 +0000
commit5dea92890e2082a35e9fafa6ec8aff55f96651cc (patch)
tree6d1031dcf5325a861498aa51bc9692b884fb556a
parentbded654ecb810bd559783b971b2abe71f83a1891 (diff)
downloadATCD-5dea92890e2082a35e9fafa6ec8aff55f96651cc.tar.gz
use local variables in ACE_OS::gethrtime () on linux
-rw-r--r--ace/OS.cpp6
-rw-r--r--ace/OS.i13
2 files changed, 4 insertions, 15 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index dffde548e8d..9ab48a4cf36 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -294,12 +294,6 @@ ACE_Countdown_Time::~ACE_Countdown_Time (void)
this->stop ();
}
-#if defined (ACE_HAS_PENTIUM) && defined (linux)
- // see comments in OS.i in ACE_OS::gethrtime () definition
- unsigned long ACE_OS_gethrtime_least;
- unsigned long ACE_OS_gethrtime_most;
-#endif /* ACE_HAS_PENTIUM && linux */
-
#if defined(ACE_MT_SAFE) && defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
int ACE_OS::netdb_mutex_inited_ = 0;
diff --git a/ace/OS.i b/ace/OS.i
index 7b15b56a4e5..f07069d9c0e 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -5771,18 +5771,13 @@ ACE_OS::gethrtime (void)
#elif defined (ACE_HAS_PENTIUM) && defined (linux)
// see comments for ACE_HAS_PENTIUM below
- // These are declared in OS.cpp. The easiest way to interface
- // with the assembly instructions is via these two global variables.
- // No, it's not thread safe. If someone knows how to do this with
- // local variables, that would be _much_ better!
- extern unsigned long ACE_OS_gethrtime_least;
- extern unsigned long ACE_OS_gethrtime_most;
+ unsigned long least, most;
asm ("rdtsc");
- asm ("movl %eax, ACE_OS_gethrtime_least");
- asm ("movl %edx, ACE_OS_gethrtime_most");
+ asm ("movl %eax, -4(%ebp)"); // least
+ asm ("movl %edx, -8(%ebp)"); // most
- return ACE_OS_gethrtime_most << 32 | ACE_OS_gethrtime_least;
+ return (unsigned long long) most << 32 | least;
#elif defined (ACE_HAS_PENTIUM)
// for WIN32 only . . .
// Issue the RDTSC assembler instruction to get the number of clock