Forum: GNU Radio gr-buffer - threadsafe?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0c696bbbd8649bac23d123975c32d5de?d=identicon&s=25 Dominik Auras (Guest)
on 2007-03-02 14:22
(Received via mailing list)

Can I assume gr_buffer + gr_buffer_reader to be thread-safe?

D0072e69d706bb3ca211d33a1b536e2c?d=identicon&s=25 Johnathan Corgan (Guest)
on 2007-03-02 17:09
(Received via mailing list)
Dominik Auras wrote:

> Can I assume gr_buffer + gr_buffer_reader to be thread-safe?

In the existing code, methods on these objects are only called by the
runtime scheduler from within a single thread, so there is no need for
thread safety.

The buffers between GNU Radio blocks are internal implementation details
that user code never needs to deal with, and might change arbitrarily.
What is it you're trying to accomplish?

Johnathan Corgan
Corgan Enterprises LLC
745d8202ef5a58c1058d0e5395a78f9c?d=identicon&s=25 Eric Blossom (Guest)
on 2007-03-02 17:51
(Received via mailing list)
On Fri, Mar 02, 2007 at 02:22:50PM +0100, Dominik Auras wrote:
> Hi!
> Can I assume gr_buffer + gr_buffer_reader to be thread-safe?
> Regards
> Dominik

Hi Dominik,

It should be fine, though I don't think it's been tested in a
multi-threaded environment.  It's single writer, multiple-reader, and
each piece of state has only a single modifier.  It's basically a
variant on the standard lock-free ring buffer.  On non-x86 machine
SMP machines (e.g. PPC) it may require the addition of memory barriers.

0c696bbbd8649bac23d123975c32d5de?d=identicon&s=25 Dominik Auras (Guest)
on 2007-03-04 21:03
(Received via mailing list)

I am designing a block, owning an inner object, and now both will need a
communication way. Since it's just one way, your buffer fulfills all my

Do you think I should use a synchronisation object (e.g. mutex)?

The inner object could possibly have an own event processing loop, i.e.
be a separate thread, and the outer block will be in a flow graph.

I know that they are implementation details, but I thought it's better
reuse them instead of writing a new implementation.

This topic is locked and can not be replied to.