On 10/16/2014 07:54 AM, mle...@ripnet.com wrote:

> Is it not the case that a given instance of a block is only ever 
> executed by a single thread, so instance variables are completely
> safe to modify in-flight?

There is one thread that alternates calling the async message handlers,
the forecast function, and the work function, so variables shared only
by these three do not need protection.

However, public functions on a block are called from another thread
context (which ever thread the user calls them from), and are completely
asynchronous to the block's runtime thread.

Many public block functions in GNU Radio are not thread-safe because of
this, but in practice work fine as Tom explained.

Now that we've had the ability to use asynchronous messaging between
blocks or from outside GNU Radio into a block for quite some time, I
would encourage block developers to take advantage of their thread-safe
nature and think about how to use them to update the operations of their
blocks vs. calling public functions.

-- 
Johnathan Corgan, Corgan Labs
SDR/DSP Training and Consulting Services
http://corganlabs.com

<<attachment: johnathan.vcf>>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to