[linux-audio-dev] Daemon mode
lars.luthman at gmail.com
Sat Dec 16 11:17:46 UTC 2006
On Sat, 2006-12-16 at 12:14 +0100, Lars Luthman wrote:
> On Sat, 2006-12-16 at 17:56 +0700, Patrick Shirkey wrote:
> > Hi,
> > I am adding a Daemon mode to jackEQ and have most of the code in place now.
> > I am stuck at the point where the daemon starts up and keeps going.
> > Essentially I need the daemon mode equivalent of gtk_main() that keeps
> > ticking over until the app is told to stop or otherwise shutdown.
> > I have not threaded the app at this point so hopefully there is a very
> > simple solution.
> So the only thread that needs to do anything is the JACK thread? In that
> case you can just add something like
> ... init code ...
> bool run = true;
> while (run) sleep(10000);
> ... cleanup code ...
> in the main thread, after setting up JACK. If you want to be nice you
> can add signal handlers for SIGHUP and SIGINT that set 'run' to false.
Ehm, and in that case you better change the sleep time to 1 or use
usleep() and specify microseconds instead. You wouldn't want to wait for
hours after trying to stop the program.
Or is sleep() interrupted by signals even if there are signal handlers
Lars Luthman - please encrypt any email sent to me if possible
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x04C77E2E
Fingerprint: FCA7 C790 19B9 322D EB7A E1B3 4371 4650 04C7 7E2E
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the Linux-audio-dev