mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Only go into eventloop/interrupt check 10 times per second
This commit is contained in:
parent
4f27a55e80
commit
7e94404081
1 changed files with 9 additions and 0 deletions
|
|
@ -351,11 +351,20 @@ scan_event_queue(flush)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TICKCOUNT 6
|
||||||
|
|
||||||
int
|
int
|
||||||
PyOS_InterruptOccurred()
|
PyOS_InterruptOccurred()
|
||||||
{
|
{
|
||||||
|
static unsigned long nextticktime;
|
||||||
|
unsigned long curticktime;
|
||||||
|
|
||||||
if (PyMac_DoYieldEnabled < 0)
|
if (PyMac_DoYieldEnabled < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
curticktime = (unsigned long)LMGetTicks();
|
||||||
|
if ( curticktime < nextticktime )
|
||||||
|
return 0;
|
||||||
|
nextticktime = curticktime + TICKCOUNT;
|
||||||
#ifdef THINK_C
|
#ifdef THINK_C
|
||||||
scan_event_queue(1);
|
scan_event_queue(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue