yield: cap at 512 iterations

This commit is contained in:
nick black 2020-08-23 23:07:06 -04:00
parent 02f59d25c2
commit 76d330c9fa
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -40,7 +40,8 @@ int yield_demo(struct notcurses* nc){
const long threshold_painted = total * 11 / 50;
timespec_div(&demodelay, 128, &scaled);
long tfilled = 0;
while(tfilled < threshold_painted){
int iters = 0;
while(tfilled < threshold_painted && iters < 512){
//fprintf(stderr, "%d/%d x %d/%d tfilled: %ld thresh: %ld total: %ld\n", vy, vx, vscaley, vscalex, tfilled, threshold_painted, total);
int pfilled = 0;
do{
@ -72,6 +73,7 @@ int yield_demo(struct notcurses* nc){
}
DEMO_RENDER(nc);
demo_nanosleep(nc, &scaled);
++iters;
}
ncvisual_destroy(wmv);