summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/s_watchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_watchdog.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/s_watchdog.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_watchdog.c b/apps/plugins/pdbox/PDa/src/s_watchdog.c
deleted file mode 100644
index e8653e9e39..0000000000
--- a/apps/plugins/pdbox/PDa/src/s_watchdog.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/* Copyright (c) 1997-2000 Miller Puckette.
2* For information on usage and redistribution, and for a DISCLAIMER OF ALL
3* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
4
5/* This file is compiled into the separate program, "pd-watchdog," which
6tries to prevent Pd from locking up the processor if it's at realtime
7priority. Linux only. Invoked from s_inter.c. */
8
9#include <sys/time.h>
10#include <sys/types.h>
11#include <unistd.h>
12#include <signal.h>
13#include <stdio.h>
14
15int main(int argc, char **argv)
16{
17 int happy = 1;
18 while (1)
19 {
20 struct timeval timout;
21 fd_set readset;
22 if (happy)
23 {
24 timout.tv_sec = 5;
25 timout.tv_usec = 0;
26 }
27 else
28 {
29 timout.tv_sec = 2;
30 timout.tv_usec = 0;
31 }
32 FD_ZERO(&readset);
33 FD_SET(0, &readset);
34 select(1, &readset, 0, 0, &timout);
35 if (FD_ISSET(0, &readset))
36 {
37 char buf[100];
38 happy = 1;
39 if (read(0, &buf, 100) <= 0)
40 return (0);
41 else continue;
42 }
43 happy = 0;
44 kill(getppid(), SIGHUP);
45 fprintf(stderr, "watchdog: signaling pd...\n");
46 }
47}
48