On Wednesday, 21 December 2011 at 04:45:48 UTC, Jonathan M Davis wrote:
On Tuesday, December 20, 2011 22:15:43 Caligo wrote:
[snip]
2. Are the new containers going to be multi-threaded? i.e., will I be
able to insert elements into a container from multiple threads?

No. That would introduce unnecessary overhead. If you want synchronized containers, then wrap the standard ones in your own. Maybe some sort of synchronized wrapper will be provided by Phobos at some point, but the containers themselves are definitely not going to be. You can add the multi- threading protections and the cost that they bring on top of an implementation that doesn't have them, but if you have such protections built-in, those using the containers can't remove them and would be stuck with the performance cost.

- Jonathan M Davis

actually, a synchronized container doesn't really provide concurrent write access, it serialized the access of multiple threads by using a lock. What about true concurrent containers such that two threads can access concurrently the same container at different places? E.g Array could be divided into chunks and each chunk is owned by a separate thread, Tree that can divide it's sub-trees among several threads, etc..

Reply via email to