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 <246...@gmail.com> 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