Avoid unconditional call to now() when allocating message

This commit is contained in:
Alexey Rybalchenko 2020-08-13 11:53:40 +02:00 committed by Dennis Klein
parent f1d6b18668
commit 62ed4e5f80

View File

@ -244,7 +244,7 @@ class Message final : public fair::mq::Message
bool InitializeChunk(const size_t size, size_t alignment = 0) bool InitializeChunk(const size_t size, size_t alignment = 0)
{ {
tools::RateLimiter rateLimiter(20); // tools::RateLimiter rateLimiter(20);
while (fMeta.fHandle < 0) { while (fMeta.fHandle < 0) {
try { try {
@ -265,7 +265,8 @@ class Message final : public fair::mq::Message
if (fManager.ThrowingOnBadAlloc()) { if (fManager.ThrowingOnBadAlloc()) {
throw MessageBadAlloc(tools::ToString("shmem: could not create a message of size ", size, ", alignment: ", (alignment != 0) ? std::to_string(alignment) : "default", ", free memory: ", fManager.Segment().get_free_memory())); throw MessageBadAlloc(tools::ToString("shmem: could not create a message of size ", size, ", alignment: ", (alignment != 0) ? std::to_string(alignment) : "default", ", free memory: ", fManager.Segment().get_free_memory()));
} }
rateLimiter.maybe_sleep(); // rateLimiter.maybe_sleep();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
if (fManager.Interrupted()) { if (fManager.Interrupted()) {
return false; return false;
} else { } else {