From 29778778a3b21d77b95ccfe92367d077180e40a3 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 14 九月 2023 13:13:46 +0800 Subject: [PATCH] 线程ID记录 --- utils/tool.py | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/utils/tool.py b/utils/tool.py index dd7b660..c2769fc 100644 --- a/utils/tool.py +++ b/utils/tool.py @@ -1,8 +1,10 @@ """ 甯哥敤宸ュ叿 """ +import ctypes import decimal import random +import threading import time import time as t import datetime @@ -234,3 +236,15 @@ if code in cache_dict: return True, cache_dict.get(code) return False, None + + +def get_thread_id(): + try: + if constant.is_windows(): + return threading.current_thread().ident + else: + thread_id = ctypes.CDLL('libc.so.6').syscall(186) # Linux涓嬬殑绯荤粺璋冪敤鍙� + return thread_id + except: + pass + return None \ No newline at end of file -- Gitblit v1.8.0