[linux-audio-dev] Re: non-RT thread waiting for RT thread

From: Juhana Sadeharju <kouhia@email-addr-hidden>
Date: Wed Apr 27 2005 - 18:18:09 EEST

>From: Andy Wingo <wingo@email-addr-hidden>
>
>socketpair(2) will do, either polling or reading in the low priority
>thread will sleep until the high priority thread writes a byte.

I hope we get all the possible methods listed now.

I have used signals for years in my alsashmrec. One process
reads A/D to a ring buffer and another process empties the ring
buffer to the disk. The problem was how to make the disk
process (non-RT process) to wait.

When the disk process has no data in the ring buffer, it goes to
sleep:
 kill((pid_t)diskpid,SIGSTOP);
When the A/D process has written enough data to the ring buffer,
it wakes up the disk process:
 kill((pid_t)diskpid,SIGCONT);
Because A/D process uses smaller buffer size, the A/D process
is executed multiple times before SIGCONT is sent.

Juhana

-- 
  http://music.columbia.edu/mailman/listinfo/linux-graphics-dev
  for developers of open source graphics software
Received on Wed Apr 27 20:15:22 2005

This archive was generated by hypermail 2.1.8 : Wed Apr 27 2005 - 20:15:22 EEST