Boost logo

Boost Users :

Subject: Re: [Boost-users] [LockFree] a queue of std::shared_ptr?
From: Brian Budge (brian.budge_at_[hidden])
Date: 2013-02-14 15:21:25


On Thu, Feb 14, 2013 at 10:17 AM, chris <chris.herssens_at_[hidden]> wrote:
> Hello All,
>
> If we can't use shared_ptr in a lockfree queue, how can I share data
> between different queue ?
>
> I have some data that I have to be put in different queues and I want to
> avoid that I have to copy this data for each queue.
>

1) Use raw pointers with boost lockfree queues
2) Use shared pointers with a std::queue and a boost::mutex to ensure
thread safety (note that this may not necessarily be slower than using
the lockfree queue)
3) Use moveable objects with boost container deque

There are more options, if one of these does not suffice.

  Brian


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