mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-18 01:22:38 -05:00
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
95fa7f6a2e
commit
513389b4c1
199 changed files with 139349 additions and 1 deletions
94
apps/plugins/pdbox/PDa/src/s_watchdog.c
Normal file
94
apps/plugins/pdbox/PDa/src/s_watchdog.c
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/* Copyright (c) 1997-2000 Miller Puckette.
|
||||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
/* This file is compiled into the separate program, "pd-watchdog," which
|
||||
tries to prevent Pd from locking up the processor if it's at realtime
|
||||
priority. Linux only. Invoked from s_inter.c. */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int happy = 1;
|
||||
while (1)
|
||||
{
|
||||
struct timeval timout;
|
||||
fd_set readset;
|
||||
if (happy)
|
||||
{
|
||||
timout.tv_sec = 5;
|
||||
timout.tv_usec = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
timout.tv_sec = 2;
|
||||
timout.tv_usec = 0;
|
||||
}
|
||||
FD_ZERO(&readset);
|
||||
FD_SET(0, &readset);
|
||||
select(1, &readset, 0, 0, &timout);
|
||||
if (FD_ISSET(0, &readset))
|
||||
{
|
||||
char buf[100];
|
||||
happy = 1;
|
||||
if (read(0, &buf, 100) <= 0)
|
||||
return (0);
|
||||
else continue;
|
||||
}
|
||||
happy = 0;
|
||||
kill(getppid(), SIGHUP);
|
||||
fprintf(stderr, "watchdog: signaling pd...\n");
|
||||
}
|
||||
}
|
||||
/* Copyright (c) 1997-2000 Miller Puckette.
|
||||
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
||||
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
|
||||
|
||||
/* This file is compiled into the separate program, "pd-watchdog," which
|
||||
tries to prevent Pd from locking up the processor if it's at realtime
|
||||
priority. Linux only. Invoked from s_inter.c. */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int happy = 1;
|
||||
while (1)
|
||||
{
|
||||
struct timeval timout;
|
||||
fd_set readset;
|
||||
if (happy)
|
||||
{
|
||||
timout.tv_sec = 5;
|
||||
timout.tv_usec = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
timout.tv_sec = 2;
|
||||
timout.tv_usec = 0;
|
||||
}
|
||||
FD_ZERO(&readset);
|
||||
FD_SET(0, &readset);
|
||||
select(1, &readset, 0, 0, &timout);
|
||||
if (FD_ISSET(0, &readset))
|
||||
{
|
||||
char buf[100];
|
||||
happy = 1;
|
||||
if (read(0, &buf, 100) <= 0)
|
||||
return (0);
|
||||
else continue;
|
||||
}
|
||||
happy = 0;
|
||||
kill(getppid(), SIGHUP);
|
||||
fprintf(stderr, "watchdog: signaling pd...\n");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue