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,
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,