discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] pmt memory management


From: Miklos Maroti
Subject: Re: [Discuss-gnuradio] pmt memory management
Date: Mon, 24 Feb 2014 16:20:20 +0100

Hi Tom,

Thanks for the clarification. I will be very careful, I promise :)

Miklos

On Mon, Feb 24, 2014 at 4:15 PM, Tom Rondeau <address@hidden> wrote:
> On Sat, Feb 22, 2014 at 1:49 PM, Miklos Maroti <address@hidden> wrote:
>> Hi Guys,
>>
>> Does copying a large pmt vector involve copying the underlying memory
>> region or do they share a single copy (refcounted)? If the do share a
>> single memory area, then can one thread modify the data of the vector
>> and will it be visible to the other thread just like regular arrays?
>>
>> Miklos
>
> Miklos,
>
> PMTs are always managed as a shared pointer (refcounted using
> boost::intrusive_ptr). So yes, you have to be careful with thread
> safety. PMTs are designed to be read-only to avoid the thread safety
> issue (for instance, when adding a key:value pair to a dictionary, you
> actually return a new PMT dictionary). The vectors are the only (and
> don't ask me why...) PMT type that is directly writable. So yes, be
> careful about thread safety issues with this structure.
>
> Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]