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