1.我目前正在看flask源码,看到werkzeug的Local用了这个函数get_ident(),然后查看源码,发现下面这种
def get_ident(): # real signature unknown; restored from __doc__
"""
get_ident() -> integer
Return a non-zero integer that uniquely identifies the current thread
amongst other threads that exist simultaneously.
This may be used to identify per-thread resources.
Even though on some platforms threads identities may appear to be
allocated consecutive numbers starting at 1, this behavior should not
be relied upon, and the number should be seen purely as a magic cookie.
A thread's identity may be reused for another thread after it exits.
"""
return 0
问题:这个怎么看都是返回0的函数,实在看不出怎么获得的线程标识符。请大家指点。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
小伙看你根骨奇佳,潜力无限,来学PHP伐。