summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-09-26 13:36:05 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-09-26 13:36:05 +0200
commit7d5061798c93655796b1cf64afd7f5b8146a7681 (patch)
tree4a059153017de09fe2d3802630f9f0b904417a92
parente478468e52fcb085f9d429cee5dd6938c80343bc (diff)
parent9129b792486b87d4f54607321427c2df783c9ec1 (diff)
Merge branch 'maint'
* maint: if TSC jumps backwards (in case of migration to a different CPU core) latency peak may occur -- fixed Conflicts: src/app_thread.cpp
-rw-r--r--src/socket_base.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 6bbff43..682062c 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -647,9 +647,11 @@ int zmq::socket_base_t::process_commands (bool block_, bool throttle_)
#else
#error
#endif
- // Check whether certain time have elapsed since last command
- // processing. If it didn't do nothing.
- 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 0;
last_processing_time = current_time;
}