Re: Improve safe iterator move semantic

2018-08-14 Thread François Dumont
On 10/08/2018 13:26, Ville Voutilainen wrote: On 10 August 2018 at 13:47, Jonathan Wakely wrote: Doing a test like this with TSan should be the absolute minimum required for any change to the mutex locking policy. Agreed. Concurrency code is something that our test suite is not well-equipped

Re: Improve safe iterator move semantic

2018-08-10 Thread Ville Voutilainen
On 10 August 2018 at 13:47, Jonathan Wakely wrote: > Doing a test like this with TSan should be the absolute minimum > required for any change to the mutex locking policy. Agreed. Concurrency code is something that our test suite is not well-equipped to test (because it doesn't support TSan and

Re: Improve safe iterator move semantic

2018-08-10 Thread Jonathan Wakely
On 10/08/18 11:00 +0100, Jonathan Wakely wrote: This valid program shows data races with -fsanitize=thread after your patch is applied: #define _GLIBCXX_DEBUG #include #include void thrash(std::vector::iterator& iter) { for (int i = 0; i < 1000; ++i) { auto jiter = std::move(iter); iter

Re: Improve safe iterator move semantic

2018-08-10 Thread Jonathan Wakely
On 09/08/18 20:41 +0200, François Dumont wrote:     Here is a patch to improve Debug mode safe iterator move semantic.     To summarize where we used to have N mutex locks we now have N - 1. For instance move constructor used to lock mutex twice, now it only does it once. Note that move

Improve safe iterator move semantic

2018-08-09 Thread François Dumont
    Here is a patch to improve Debug mode safe iterator move semantic.     To summarize where we used to have N mutex locks we now have N - 1. For instance move constructor used to lock mutex twice, now it only does it once. Note that move constructor or move assignment operator are currently