Hello Prashant, Prashant Thakre ha escrito:
Hi, As per the section "Complexity and exception safety": Iterator and reference validity is preserved in the face of insertions, even for replace and modify operations.
Please note that exception safety is in no way related to thread safety.
Would it be safe to insert() from within two or more threads simultaneously ? Assumption being that the keys inserted will be always be different.
No, it is not safe to insert from two threads into the same container. The thread safety guarantees aplying to Boost.MultiIndex (and to most STL implementations as well) are: 1. Concurrent access to different containers is safe. 2. Concurrent read-only access to the same container is safe All other forms of concurrent access are *not* safe, for instance: * Concurrent write access to the same container (your scenario) is not safe. * One thread writes to a container and other(s) read(s) from the same container: not safe either. So you've got to synchronize access to the container as appropriate to your app semantics.
regards, Prashant Thakre
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo