[AD] PATCH: sleep in xwindows vsync emulation

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi all,

I noticed while porting a game to allegro that it was a cpuhog, it truned out that it used the vsync() call to regulate its framerate and that the current vsync emulation in xwin.c busy waits, which is really not the unix way.

Attached a simple patch which causes allegro to sleep
while waiting in the vsync emulation function.

Regards,

Hans

p.s.

I never heard anything about by mmap and mremap instead of malloc and realloc pathc for the asm stretch blit code generation. Is it ok, will you apply it or?

--- allegro-4.2.0/src/x/xwin.c~	2006-03-21 12:57:42.000000000 +0100
+++ allegro-4.2.0/src/x/xwin.c	2006-03-21 12:57:42.000000000 +0100
@@ -2265,6 +2265,7 @@
       XUNLOCK();
 
       do {
+         rest(1);
       } while (retrace_count == prev);
    }
    else {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/