Hi everyone - I'm new to boost-devel, and am a bit intimidated ;) I recently finished a project and I don't know if the boost community would have any interest in it, whether it's really "boost material" or not: https://github.com/KarenRei/safe-map The page goes into more detail, but the short of it is: after searching and a long conversation on StackExchange, I discovered that while there are threadsafe ordered-map containers out there, the threadsafety was a bit weak. For example, if you have Thread A iterating across the map and Thread B thread just happens to delete an element as A is passing by, A's iterator becomes invalidated and the program crashes - even in a supposedly "threadsafe" map. For the type of multithreaded cache that I needed, I needed a structure that had the thread safety level of a filesystem - you know, where multiple processes can have file descriptors open at a time and one process might even potentially delete a file that another is accessing, without leading to a system crash. And that's basically what I implemented: safe::map, which not only ensures that basic operations on the container itself are threadsafe, but that everything you do with the iterators - even deleting elements out of the map that other iterators are pointing to - is also threadsafe. It does this by implementing reference counting on the elements in the map and flagging elements for deletion rather than deleting them immediately. A more detailed description of usage, performance, implementation, use cases, etc is on the project page. The project comes with a test suite which launches a number of threads that endlessly randomly tweak and iterate around the map with every function available to them. Does this sound like something that might be useful in boost (after whatever changes would be required)? If there's no interest, no harm done :) - kv, Karen
Karen Pease
Hi everyone - I'm new to boost-devel, and am a bit intimidated ;) I recently finished a project and I don't know if the boost community would have any interest in it, whether it's really "boost material" or not:
https://github.com/KarenRei/safe-map
[...]
Karen, Thanks for reaching out to this list. This looks interesting, but I was completely bewildered by the different iteration types. Why did you decide to include all these iteration types, as opposed to only providing normal bidirectional traversal (like std::map)? Sometimes, having fewer options is better (because less confusing), and I felt like it was the case here. But I might have missed something, too. Regards, Louis Dionne
I could certainly remove the other iterator types if they only lead to
confusion. I initially added them in as my personal needs called for a
circular map as well as a standard non-wrapping one, and so while I was
extending it with my needs I decided to just offer a range of iteration
types. But again, if they're a problem they can be removed. :)
As a side node, based on a request on the github page I've downgraded from
c++14 to c++11 so that it can work on older compilers. Hopefully it won't
need to go more primitive than c++11 ;)
- kv, Karen
On Sun, Dec 20, 2015 at 1:21 PM, Louis Dionne
Karen Pease
writes: Hi everyone - I'm new to boost-devel, and am a bit intimidated ;) I
recently
finished a project and I don't know if the boost community would have any interest in it, whether it's really "boost material" or not:
https://github.com/KarenRei/safe-map
[...]
Karen,
Thanks for reaching out to this list.
This looks interesting, but I was completely bewildered by the different iteration types. Why did you decide to include all these iteration types, as opposed to only providing normal bidirectional traversal (like std::map)? Sometimes, having fewer options is better (because less confusing), and I felt like it was the case here. But I might have missed something, too.
Regards, Louis Dionne
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Karen Pease
-
Karen Pease
-
Louis Dionne