libcds

Can we do something atomically with 2 or more lock-free containers without locking both?

自作多情 提交于 2019-12-11 05:35:10
问题 I'm looking for Composable operations - it fairly easily to do using transactional memory. (Thanks to Ami Tavory) And it easily to do using locks (mutex/spinlock) - but it can lead to deadlocks - so lock-based algorithms composable only with manual tuning. Lock-free algorithms do not have the problem of deadlocks, but it is not composable. Required to designed 2 or more containers as a single composed lock-free data structure. Is there any approach, helper-implementation or some lock-free

LibCds: Michael Hashmap and Split Order List

家住魔仙堡 提交于 2019-12-04 12:13:20
问题 I am using libcds and they have an implementation of Michael Hash Map and Split order list. Based on the information I gathered from the doc here is how I implemented them: includes: #include <cds/map/michael_hash_map.h> #include <cds/map/split_ordered_list.h> using namespace cds; Code: class TestDs { public: virtual bool containsKey(int key)=0; virtual int get(int key)=0; virtual int put(int key, int value)=0; virtual int remove(int key)=0; virtual int size()=0; virtual const char* name()=0;

LibCds: Michael Hashmap and Split Order List

醉酒当歌 提交于 2019-12-03 08:30:07
I am using libcds and they have an implementation of Michael Hash Map and Split order list. Based on the information I gathered from the doc here is how I implemented them: includes: #include <cds/map/michael_hash_map.h> #include <cds/map/split_ordered_list.h> using namespace cds; Code: class TestDs { public: virtual bool containsKey(int key)=0; virtual int get(int key)=0; virtual int put(int key, int value)=0; virtual int remove(int key)=0; virtual int size()=0; virtual const char* name()=0; virtual void print()=0; virtual void shutdown()=0; }; Code: class Michael: public TestDs{ private: cds