diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-24 21:28:16 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-24 21:28:16 +0000 |
commit | 526b5580dabbfed7cfe5439dc3a90ec727f563c2 (patch) | |
tree | 22b1af92348785daad16714ee5e2b633017e0e48 /apps/plugins/pdbox/PDa/src/s_watchdog.c | |
parent | 4f2dfcc01b260d946044ef2b6af5fe36cb772c8d (diff) | |
download | rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.tar.gz rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.zip |
Cut the files in half and it might work better (note to self: check your tree is really clean before patching)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21070 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/s_watchdog.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/s_watchdog.c | 46 |
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 | ||
53 | tries to prevent Pd from locking up the processor if it's at realtime | ||
54 | priority. 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 | |||
62 | int 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 | } | ||