Re: [LAD] Writing to an eventfd from a realtime thread

From: Clemens Ladisch <clemens@email-addr-hidden>
Date: Wed Sep 24 2014 - 15:12:09 EEST

William Light wrote:
> At the moment, when the audio thread (the JACK callback) needs to send a
> message over a channel to another thread, it follows the common codepath
> of appending the message to the channel's ring-buffer and then
> write()ing to the eventfd. I suspect this is not real-time safe, but is
> it something I should lose sleep over?

Well, you should know how your ring buffer behaves (i.e., if it drops
the message or blocks when it overflows).

As for the eventfd, it could block only if the counter value
exceeded 0xfffffffffffffffe. I'd guess your ring buffer cannot get
that big.

(With the ring buffer and the eventfd, you are implementing what looks
like a pipe. If you need to copy the data to the ring buffer anyway,
and if your messages and the entire buffer fit into the pipe limits
(4 KB and 1 MB), you could simply use a pipe to begin with; see
<http://man7.org/linux/man-pages/man7/pipe.7.html>.)

Regards,
Clemens
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Wed Sep 24 16:15:02 2014

This archive was generated by hypermail 2.1.8 : Wed Sep 24 2014 - 16:15:02 EEST