summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-09-26 13:30:33 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-09-26 13:30:33 +0200
commit9129b792486b87d4f54607321427c2df783c9ec1 (patch)
treeba8b29e2f44884ebe1a81e724afbe7b6e1f49f83
parente2802d9a4b7e518c549e8dd95a34d2424058f086 (diff)
if TSC jumps backwards (in case of migration to a different CPU core) latency peak may occur -- fixed
-rw-r--r--src/app_thread.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/app_thread.cpp b/src/app_thread.cpp
index ac59464..fc9bc1f 100644
--- a/src/app_thread.cpp
+++ b/src/app_thread.cpp
@@ -111,9 +111,11 @@ bool zmq::app_thread_t::process_commands (bool block_, bool throttle_)
#error
#endif
- // Check whether certain time have elapsed since last command
- // processing.
- if (current_time - last_processing_time <= max_command_delay)
+ // Check whether TSC haven't jumped backwards (in case of migration
+ // between CPU cores) and whether certain time have elapsed since
+ // last command processing. If it didn't do nothing.
+ if (current_time >= last_processing_time &&
+ current_time - last_processing_time <= max_command_delay)
return !terminated;
last_processing_time = current_time;
}