From 9753f3877158341111d82ff1d38804823db55759 Mon Sep 17 00:00:00 2001 From: lyon Date: Fri, 9 Aug 2024 03:30:07 +0800 Subject: [PATCH] lock version 1.13.4 for _thread --- examples/_thread/thread_issue1.py | 4 ++-- package/_thread/_thread.c | 6 ++++++ .../package/pikascript/pikascript-lib/_thread/_thread.c | 4 ++++ port/linux/version_config.py | 2 +- src/PikaVersion.h | 4 ++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/_thread/thread_issue1.py b/examples/_thread/thread_issue1.py index 06f2d3b82..7d2edaaaa 100644 --- a/examples/_thread/thread_issue1.py +++ b/examples/_thread/thread_issue1.py @@ -5,10 +5,10 @@ def task2(): while True: print("123") - time.sleep_ms(2001) + time.sleep_ms(201) _thread.start_new_thread(task2, ()) while True: - time.sleep_ms(2000) + time.sleep_ms(200) diff --git a/package/_thread/_thread.c b/package/_thread/_thread.c index 39f3d353a..15bbdc2b1 100644 --- a/package/_thread/_thread.c +++ b/package/_thread/_thread.c @@ -3,6 +3,10 @@ #include "TinyObj.h" #include "dataMemory.h" +#if !PIKASCRIPT_VERSION_REQUIRE_MINIMUN(1, 13, 4) +#error "pikapython version must be greater than 1.13.4" +#endif + static volatile int g_thread_stack_size = PIKA_THREAD_STACK_SIZE; #if !PIKA_THREAD_MALLOC_STACK_ENABLE extern volatile PikaMemInfo g_PikaMemInfo; @@ -43,6 +47,8 @@ typedef struct pika_thread_info { static void _thread_func(void* arg) { pika_debug("thread start"); pika_GIL_ENTER(); + PikaVMThread* vmThread = pikaVMThread_require(); + vmThread->is_sub_thread = 1; PikaObj* ctx = New_TinyObj(NULL); pika_thread_info* info = (pika_thread_info*)arg; if (NULL != info->args) { diff --git a/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c b/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c index 46b3899fa..15bbdc2b1 100644 --- a/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c +++ b/port/linux/package/pikascript/pikascript-lib/_thread/_thread.c @@ -3,6 +3,10 @@ #include "TinyObj.h" #include "dataMemory.h" +#if !PIKASCRIPT_VERSION_REQUIRE_MINIMUN(1, 13, 4) +#error "pikapython version must be greater than 1.13.4" +#endif + static volatile int g_thread_stack_size = PIKA_THREAD_STACK_SIZE; #if !PIKA_THREAD_MALLOC_STACK_ENABLE extern volatile PikaMemInfo g_PikaMemInfo; diff --git a/port/linux/version_config.py b/port/linux/version_config.py index 91859921a..f65e45c45 100644 --- a/port/linux/version_config.py +++ b/port/linux/version_config.py @@ -1,3 +1,3 @@ MajorVersion = "1" MinorVersion = "13" -MicroVersion = "3" +MicroVersion = "4" diff --git a/src/PikaVersion.h b/src/PikaVersion.h index 592329b55..11ea23958 100644 --- a/src/PikaVersion.h +++ b/src/PikaVersion.h @@ -1,5 +1,5 @@ #define PIKA_VERSION_MAJOR 1 #define PIKA_VERSION_MINOR 13 -#define PIKA_VERSION_MICRO 3 +#define PIKA_VERSION_MICRO 4 -#define PIKA_EDIT_TIME "2024/08/09 03:28:08" +#define PIKA_EDIT_TIME "2024/08/09 03:29:21"