# GNU Radio Multithreading application issue

**URL:** <https://www.ruby-forum.com/t/gnu-radio-multithreading-application-issue/246316>\
**Category:** GNU Radio\
**Created:** [September 30, 2013, 8:02am UTC](https://www.ruby-forum.com/t/gnu-radio-multithreading-application-issue/246316 "2013-09-30T08:02:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [September 30, 2013, 8:02am UTC](https://www.ruby-forum.com/t/gnu-radio-multithreading-application-issue/246316/1 "2013-09-30T08:02:57Z")

</div>

Hello list,

I have coded a top block flow graph which connect some custom modulator  
shared pointer to a USRP sink,  
The question is that apart from the thread that is being run when  
calling  
tb-\>start, I would like to have running in the background either a  
daemon-like process which access a (static variable) queue member of the  
modulator class or a thread which can be detached.

I tried a lot of codes but unsuccessfully, when I try to test the whole  
flow  
graph working I realise (by some printf) that the code is executing the  
core  
of the modulator work only once (the top block process) wherever the  
other  
thread (called after tb-\>start) is being executed continuously (inside  
while  
loop).

Sorry if the question seems so confusing, but to be clear I like to know  
how  
can the  
\* modulator connected to usrp sink  
and the \* thread called after tb-\>start be executed  
simultaneously  
(multithreaded)

I tried to implement a daemon from inside the modulator core but did not  
succed to make it execute continuously,

BTW I referred to:  
[http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html](http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html)  
and also I tried to call: boost::thread t(boost::bind(foo,param1…))  
t.detach();  
==\> Unsucess

Tried many other ways but always the ‘foo’ is being executed only once.  
How can I have it execute alongsie of the top-block process running and  
reading and writing the same variable without conflict or seg fault or  
any  
other issue.

All explanations or hints are well appreciated,  
Best regards,

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/GNU-Radio-Multithreading-application-issue-tp43878.html](http://gnuradio.4.n7.nabble.com/GNU-Radio-Multithreading-application-issue-tp43878.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).
