Boost logo

Boost Users :

Subject: Re: [Boost-users] circular buffer in a multithreaded program
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-04-22 14:02:55


2014-04-22 15:47 GMT+04:00 Sebastian Gesemann <s.gesemann_at_[hidden]>:
<...>

> - locking a mutex
> - calling cb.erase_first(n);
> - calling cb.resize(cb.capacity());
> - notify writer that there is new free space to write stuff into
> - unlocking the mutex
>

This is what was happening in the reader thread. What was happening in the
writer thread?

> But the program did not work. The first thing that came to my
> attention was that the checked iterators of circular_buffer don't
> support this kind of multithreading as they register and unregister
> themselves into a linked list without any synchronization.
>

I had exactly the same thoughts...

-- 
Best regards,
Antony Polukhin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net