[PD] What exactly is a "stack overflow" ?
Russell Bryant
russell at russellbryant.net
Thu Dec 20 01:10:39 CET 2007
Russell Bryant wrote:
> static void until_bang(t_until *x)
> {
> x->x_run = 1;
> x->x_count = -1;
> while (x->x_run && x->x_count)
> x->x_count--, outlet_bang(x->x_obj.ob_outlet);
> }
Furthermore, if this loop is eating up CPU and making the system unresponsive,
you can make the situation much better by adding a simple sleep that makes the
process yield to to other waiting processes on each iteration of the loop. The
new version would look like:
static void until_bang(t_until *x)
{
x->x_run = 1;
x->x_count = -1;
while (x->x_run && x->x_count) {
x->x_count--;
outlet_bang(x->x_obj.ob_outlet);
usleep(1);
}
}
More information about the Pd-list
mailing list