Boost logo

Boost Users :

Subject: Re: [Boost-users] are boost::interprocess containers thread-safe?
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-12-17 08:56:44


El 17/12/2009 14:44, blp330 escribió:
>
> Hi,
>
> I must implement a multiple producer-consumer IPC application in win32 (but
> will port to linux in near future). I am wondering whether the
> boost::interprocess container like list, vector or map is thread-safe
> (actually, interprocess-safe?) or I need to use lock in my producer-consumer
> application?

They offer the same guarantees as standard containers: it's safe to read
a container from two threads. It's unsafe to read and write it at the
same time. You'll need to use locks/condition variables for that, just
like you'll need to do for containers shared between threads of the same
process.

Best,

Ion


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