mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
fix time.sleep() thread switch with small time
This commit is contained in:
parent
7001eb846e
commit
3778a36a49
@ -13,13 +13,16 @@ volatile int g_pika_local_timezone = 8;
|
||||
|
||||
static void _do_sleep_ms_tick(uint32_t ms) {
|
||||
int64_t tick = pika_platform_get_tick();
|
||||
while (pika_platform_get_tick() - tick < ms) {
|
||||
while (1) {
|
||||
pika_platform_thread_delay();
|
||||
#if PIKA_EVENT_ENABLE
|
||||
if (!g_PikaVMSignal.event_thread_inited) {
|
||||
_VMEvent_pickupEvent();
|
||||
}
|
||||
#endif
|
||||
pika_platform_thread_delay();
|
||||
if(pika_platform_get_tick() - tick >= ms){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user