diff -r ffa851df0825 -r 2fb8b9db1c86 symbian-qemu-0.9.1-12/python-2.6.1/RISCOS/sleep.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/python-2.6.1/RISCOS/sleep.c Fri Jul 31 15:01:17 2009 +0100 @@ -0,0 +1,41 @@ +#include "oslib/osmodule.h" +#include +#include "kernel.h" +#include +#include +#include "oslib/taskwindow.h" +#include "Python.h" + + +int riscos_sleep(double delay) +{ + os_t starttime, endtime, time; /* monotonic times (centiseconds) */ + int *pollword, ret; + osbool claimed; + + /* calculate end time */ + starttime = os_read_monotonic_time(); + if (starttime + 100.0*delay >INT_MAX) + endtime = INT_MAX; + else + endtime = (os_t)(starttime + 100.0*delay); + + /* allocate (in RMA) and set pollword for xupcall_sleep */ + pollword = osmodule_alloc(4); + *pollword = 1; + + time = starttime; + ret = 0; + while ( time=starttime ) { + xupcall_sleep (pollword, &claimed); + if (PyErr_CheckSignals()) { + ret = 1; + break; + } + time = os_read_monotonic_time(); + } + + /* deallocate pollword */ + osmodule_free(pollword); + return ret; +}