Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7e94404

Browse files
committed
Only go into eventloop/interrupt check 10 times per second
1 parent 4f27a55 commit 7e94404

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Mac/Python/macglue.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,20 @@ scan_event_queue(flush)
351351
}
352352
}
353353

354+
#define TICKCOUNT 6
355+
354356
int
355357
PyOS_InterruptOccurred()
356358
{
359+
static unsigned long nextticktime;
360+
unsigned long curticktime;
361+
357362
if (PyMac_DoYieldEnabled < 0)
358363
return 0;
364+
curticktime = (unsigned long)LMGetTicks();
365+
if ( curticktime < nextticktime )
366+
return 0;
367+
nextticktime = curticktime + TICKCOUNT;
359368
#ifdef THINK_C
360369
scan_event_queue(1);
361370
#endif

0 commit comments

Comments
 (0)