[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Sorry, here it is :/
--
Vincent Penquerc'h
Windows NT - New Trial
diff -U 3 -N --recursive allegro.3.9.30.original/include/allegro/aintunix.h allegro/include/allegro/aintunix.h
--- allegro.3.9.30.original/include/allegro/aintunix.h Tue Dec 21 19:36:53 1999
+++ allegro/include/allegro/aintunix.h Sat Jan 8 17:01:27 2000
@@ -53,6 +53,10 @@
AL_FUNC(void, _read_os_type, (void));
+ /* Helper for yield CPU */
+ AL_FUNC(void, _unix_yield_timeslice, (void));
+
+
#ifdef ALLEGRO_WITH_XWINDOWS
AL_FUNCPTR(void, _xwin_keyboard_interrupt, (int pressed, int code));
AL_FUNCPTR(void, _xwin_keyboard_focused, (int focused));
diff -U 3 -N --recursive allegro.3.9.30.original/include/allegro/alinline.h allegro/include/allegro/alinline.h
--- allegro.3.9.30.original/include/allegro/alinline.h Sun Dec 19 12:18:46 1999
+++ allegro/include/allegro/alinline.h Sat Jan 8 16:52:33 2000
@@ -206,6 +206,16 @@
+AL_INLINE(void, yield_timeslice, (void),
+{
+ ASSERT(system_driver);
+
+ if (system_driver->yield_timeslice)
+ system_driver->yield_timeslice();
+})
+
+
+
/*******************************************/
/************ Graphics routines ************/
/*******************************************/
diff -U 3 -N --recursive allegro.3.9.30.original/include/allegro.h allegro/include/allegro.h
--- allegro.3.9.30.original/include/allegro.h Tue Dec 21 19:36:53 1999
+++ allegro/include/allegro.h Sat Jan 8 16:52:33 2000
@@ -167,6 +167,7 @@
AL_METHOD(int, set_display_switch_callback, (int dir, AL_METHOD(void, cb, (void))));
AL_METHOD(void, remove_display_switch_callback, (AL_METHOD(void, cb, (void))));
AL_METHOD(void, display_switch_lock, (int lock, int foreground));
+ AL_METHOD(void, yield_timeslice, (void));
AL_METHOD(_DRIVER_INFO *, gfx_drivers, (void));
AL_METHOD(_DRIVER_INFO *, digi_drivers, (void));
AL_METHOD(_DRIVER_INFO *, midi_drivers, (void));
diff -U 3 -N --recursive allegro.3.9.30.original/src/allegro.c allegro/src/allegro.c
--- allegro.3.9.30.original/src/allegro.c Mon Nov 22 02:31:34 1999
+++ allegro/src/allegro.c Sat Jan 8 16:52:33 2000
@@ -598,7 +598,7 @@
sys_none_init,
sys_none_exit,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
sys_no_driver, sys_no_driver, sys_no_driver, sys_no_driver,
sys_no_driver, sys_no_driver, sys_no_driver
};
diff -U 3 -N --recursive allegro.3.9.30.original/src/beos/bsystem.c allegro/src/beos/bsystem.c
--- allegro.3.9.30.original/src/beos/bsystem.c Mon Nov 22 02:31:48 1999
+++ allegro/src/beos/bsystem.c Sat Jan 8 16:52:33 2000
@@ -51,6 +51,7 @@
NULL, // AL_METHOD(int, set_display_switch_callback, (int dir, AL_METHOD(void, cb, (void))));
NULL, // AL_METHOD(int, remove_display_switch_callback, (AL_METHOD(void, cb, (void))));
NULL, // AL_METHOD(void, display_switch_lock, (int lock));
+ NULL, // AL_METHOD(void, yield_timeslice, (void));
NULL, // AL_METHOD(_DRIVER_INFO *, gfx_drivers, (void));
NULL, // AL_METHOD(_DRIVER_INFO *, digi_drivers, (void));
NULL, // AL_METHOD(_DRIVER_INFO *, midi_drivers, (void));
diff -U 3 -N --recursive allegro.3.9.30.original/src/dos/dsystem.c allegro/src/dos/dsystem.c
--- allegro.3.9.30.original/src/dos/dsystem.c Mon Nov 22 02:31:48 1999
+++ allegro/src/dos/dsystem.c Sat Jan 8 16:52:33 2000
@@ -90,6 +90,7 @@
static void sys_dos_restore_console_state(void);
static void sys_dos_read_palette(void);
static void sys_dos_set_palette(struct RGB *p, int from, int to, int vsync);
+static void sys_dos_yield_timeslice(void);
#ifdef ALLEGRO_DJGPP
static void sys_dos_assert(char *msg);
@@ -115,7 +116,9 @@
NULL, NULL, NULL, NULL, NULL,
sys_dos_read_palette,
sys_dos_set_palette,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL, NULL,
+ sys_dos_yield_timeslice,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
@@ -557,5 +560,17 @@
void _restore_vga_mode(void)
{
/* nothing to be done in DOS */
+}
+
+
+
+/* sys_dos_yield_timeslice:
+ * Yields the remaining timeslice portion to the system
+ */
+static void sys_dos_yield_timeslice()
+{
+#ifdef ALLEGRO_DJGPP
+ __dpmi_yield();
+#endif
}
diff -U 3 -N --recursive allegro.3.9.30.original/src/linux/lsystem.c allegro/src/linux/lsystem.c
--- allegro.3.9.30.original/src/linux/lsystem.c Tue Dec 21 19:36:54 1999
+++ allegro/src/linux/lsystem.c Sat Jan 8 17:03:24 2000
@@ -81,6 +82,7 @@
__al_linux_set_display_switch_callback,
__al_linux_remove_display_switch_callback,
__al_linux_display_switch_lock,
+ _unix_yield_timeslice,
get_gfx_driver_list,
NULL, /* digi_driver_list */
NULL, /* midi_driver_list */
@@ -240,5 +242,6 @@
free(tmp);
}
+
diff -U 3 -N --recursive allegro.3.9.30.original/src/unix/usystem.c allegro/src/unix/usystem.c
--- allegro.3.9.30.original/src/unix/usystem.c Mon Nov 22 02:31:48 1999
+++ allegro/src/unix/usystem.c Sat Jan 8 17:02:21 2000
@@ -23,6 +23,14 @@
#include <sys/utsname.h>
#endif
+#ifdef _POSIX_PRIORITY_SCHEDULING
+/*
+ * Manpages say systems providing sched_yield() define
+ * _POSIX_PRIORITY_SCHEDULING in unistd.h
+ */
+#include <sched.h>
+#endif
+
/* list the available drivers */
@@ -119,6 +127,23 @@
os_type = OSTYPE_UNIX;
#endif
+}
+
+
+
+/* _unix_sysdrv_yield_timeslice:
+ * Yields remaining timeslice portion to the system
+ */
+void _unix_yield_timeslice(void)
+{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sched_yield();
+#else
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tc_usec = 1;
+ select(0,NULL,NULL,NULL,&timeout);
+#endif
}
diff -U 3 -N --recursive allegro.3.9.30.original/src/win/wsystem.c allegro/src/win/wsystem.c
--- allegro.3.9.30.original/src/win/wsystem.c Tue Dec 21 19:36:54 1999
+++ allegro/src/win/wsystem.c Sat Jan 8 16:52:33 2000
@@ -70,6 +70,7 @@
sys_directx_set_display_switch_callback,
sys_directx_remove_display_switch_callback,
NULL, /* AL_METHOD(void, display_switch_lock, (int lock)); */
+ NULL, /* AL_METHOD(void, yield_timeslice, (void)); */
NULL, /* AL_METHOD(_DRIVER_INFO *, gfx_drivers, (void)); */
_get_digi_driver_list, /* AL_METHOD(_DRIVER_INFO *, digi_drivers, (void)); */
_get_midi_driver_list, /* AL_METHOD(_DRIVER_INFO *, midi_drivers, (void)); */
diff -U 3 -N --recursive allegro.3.9.30.original/src/x/xsystem.c allegro/src/x/xsystem.c
--- allegro.3.9.30.original/src/x/xsystem.c Tue Dec 21 19:36:55 1999
+++ allegro/src/x/xsystem.c Sat Jan 8 17:03:36 2000
@@ -72,6 +72,7 @@
NULL, /* set_display_switch_callback */
NULL, /* remove_display_switch_callback */
NULL, /* display_switch_lock */
+ _unix_yield_timeslice,
_xwin_sysdrv_gfx_drivers,
NULL, /* digi_driver_list */
NULL, /* midi_driver_list */