python thread.get_ident()源码的疑惑
伊谢尔伦
伊谢尔伦 2017-04-18 09:41:47
[Python讨论组]

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的函数,实在看不出怎么获得的线程标识符。请大家指点。
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号