Boost logo

Ublas :

Subject: Re: [ublas] vector / matrix thread write access
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-08-31 05:21:37


Hi,

thanks for the answer, but need I a read-lock?
I have got a empty ublas vector and every thread creates a write lock
writes the data in a element and unlocks. After the data is in the
vector
every thread can read, but no thread must change it.

I'm a little unsafe that I need both locks

Thanks

Phil

Am 31.08.2010 um 02:57 schrieb Vardan Akopian:

> uBlas containers are definitely not thread safe, so you need to
> implement your own synchronization, by keeping a lock (possible a
> read-write lock) when accessing the container. You could use the Boost
> Thread library for that purpose.
>
> On Mon, Aug 30, 2010 at 6:54 AM, Kraus Philipp
> <philipp.kraus_at_[hidden]> wrote:
>> Hi,
>>
>> I use a ublas::vector for caching some data between threads. One of
>> my
>> threads sould write data into a position of the vector and the
>> other thread
>> should be read the data. In some cases more than one thread can
>> write to the
>> vector on the same position. Every thread that sets the data
>> creates the
>> same data, so it is irrelevant which thread writes.
>>
>> Are ublas::matrix and ublas::vector for reading and writing on the
>> same
>> indexposition thread-safe?
>> If they are not, how can I make them thread-safe?
>>
>> Thanks
>>
>> Phil
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: vakopian_at_[hidden]
>>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: philipp.kraus_at_[hidden]