Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] Concurrent vector assignment
From: David White (dawhite32_at_[hidden])
Date: 2012-01-01 23:29:00


Thanks Stefan and Gregory for your comments.

Just to confirm - yes, I meant std::vector, I am using msvc/msvcrt and gnu c++/libstdc++, each thread uses locally defined iterators, and resize (including other size/capacity/order modifying methods) is not used.

The issue of one thread reading and another thread writing without a memory barrier is not a concern (in this context) since I am using a thread-safe queue (std:queue), thanks to A. Williams' "C++ concurrency in action". Hence, I can guarantee that no two threads ever change the value of a single element - each element is only ever modified by one thread.

So far, I am not seeing any exceptions or memory issues and all is working well - but this is no guarantee that it is safe.

Do you know if msvc and/or gnu c++ std::vector implementations support thread-safety for this behaviour?

Kind regards, David.


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk