From 3454d1bdf5ec9e3b08f40cfa1c43e6febd6e803b Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 31 Jan 2015 23:51:45 -0800 Subject: [PATCH] EntryTable needs a rewrite. --- src/alloy/runtime/entry_table.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/alloy/runtime/entry_table.cc b/src/alloy/runtime/entry_table.cc index 96c97132d..3cbc015f6 100644 --- a/src/alloy/runtime/entry_table.cc +++ b/src/alloy/runtime/entry_table.cc @@ -39,6 +39,9 @@ Entry* EntryTable::Get(uint64_t address) { } Entry::Status EntryTable::GetOrCreate(uint64_t address, Entry** out_entry) { + // TODO(benvanik): replace with a map with wait-free for find. + // https://github.com/facebook/folly/blob/master/folly/AtomicHashMap.h + lock_.lock(); const auto& it = map_.find(address); Entry* entry = it != map_.end() ? it->second : nullptr; @@ -50,7 +53,7 @@ Entry::Status EntryTable::GetOrCreate(uint64_t address, Entry** out_entry) { do { lock_.unlock(); // TODO(benvanik): sleep for less time? - poly::threading::Sleep(std::chrono::microseconds(100)); + poly::threading::Sleep(std::chrono::microseconds(10)); lock_.lock(); } while (entry->status == Entry::STATUS_COMPILING); }