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.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/apps/plugins/pdbox/PDa/src/s_watchdog.c b/apps/plugins/pdbox/PDa/src/s_watchdog.c
index 48309c16c4..e8653e9e39 100644
--- a/apps/plugins/pdbox/PDa/src/s_watchdog.c
+++ b/apps/plugins/pdbox/PDa/src/s_watchdog.c
@@ -45,50 +45,4 @@ int main(int argc, char **argv)
45 fprintf(stderr, "watchdog: signaling pd...\n"); 45 fprintf(stderr, "watchdog: signaling pd...\n");
46 } 46 }
47} 47}
48/* Copyright (c) 1997-2000 Miller Puckette.
49* For information on usage and redistribution, and for a DISCLAIMER OF ALL
50* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
51
52/* This file is compiled into the separate program, "pd-watchdog," which
53tries to prevent Pd from locking up the processor if it's at realtime
54priority. Linux only. Invoked from s_inter.c. */
55 48
56#include <sys/time.h>
57#include <sys/types.h>
58#include <unistd.h>
59#include <signal.h>
60#include <stdio.h>
61
62int main(int argc, char **argv)
63{
64 int happy = 1;
65 while (1)
66 {
67 struct timeval timout;
68 fd_set readset;
69 if (happy)
70 {
71 timout.tv_sec = 5;
72 timout.tv_usec = 0;
73 }
74 else
75 {
76 timout.tv_sec = 2;
77 timout.tv_usec = 0;
78 }
79 FD_ZERO(&readset);
80 FD_SET(0, &readset);
81 select(1, &readset, 0, 0, &timout);
82 if (FD_ISSET(0, &readset))
83 {
84 char buf[100];
85 happy = 1;
86 if (read(0, &buf, 100) <= 0)
87 return (0);
88 else continue;
89 }
90 happy = 0;
91 kill(getppid(), SIGHUP);
92 fprintf(stderr, "watchdog: signaling pd...\n");
93 }
94}