sestoft / C5

C5 generic collection library for C#/.NET
http://www.itu.dk/research/c5/
MIT License
1.03k stars 181 forks source link

Thread safety #36

Closed tkirill closed 8 years ago

tkirill commented 8 years ago

Hi!

Can't find anything about thread safety in the documentation. Are all collections thread safe or not? Especially I'm interested in IntervalHeap.

sestoft commented 8 years ago

On 12Oct15 9:17, "Kirill Teplinskiy" notifications@github.com<mailto:notifications@github.com> wrote:

Can't find anything about thread safety in documentation. Are all collections thread safe or not? Especially I'm interesting in IntervalHeap.

No part of C5 is designed to be thread safe. Search for "synchronized" in the C5 book.

It is commonly recognized that it is useless to make individual collection classes thread-safe unless they are also implemented in a manner that scales well with increased concurrency (such as .NET ConcurrentDictionary or Java's ConcurrentHashMap).

Instead, add you own locking, or confine access to one thread.

We have started working on thread-safe and scalable C5 collections, but this will take some time.

Peter

tkirill commented 8 years ago

@sestoft Thanks for clarification!