discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Multithreading in GR blocks


From: Albin Stigö
Subject: Re: Multithreading in GR blocks
Date: Mon, 13 Apr 2020 20:10:51 +0200

An alternative is to use none blocking IO and use poll or select in your worker thread and use another fd created with pipe(2) to signal that you are done... Or a timer fd like Sylvain suggests. Not sure if boost has some portability wrapping for this?

--Albin

On Mon, Apr 13, 2020, 19:59 Sylvain Munaut <address@hidden> wrote:
The m_finished thing only works if you're not using any blocking calls.

But you're using `accept` and `recv` etc ... all calls that can block
forever until they get something.
You need to use `select` on the file descriptors while waiting for
events / data and set a timeout on that select so your code has a
periodic opportunity to check the m_finished flag.

Cheers,

    Sylvain


reply via email to

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