浙江省高等学校教师教育理论培训

微信搜索“教师资格证岗前培训”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

python thread之daemon - 游牧之python学习笔记 - 博客频道 - CSDN.NET

python thread之daemon

分类: python 380人阅读 评论(0) 收藏 举报
daemon

A boolean value indicating whether this thread is a daemon thread (True) or not (False). This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.

The entire Python program exits when no alive non-daemon threads are left.

当daemon被设置为True时,如果主线程退出,那么子线程也将跟着退出,

反之,子线程将继续运行,直到正常退出。

posted on 2013-01-21 13:28  lexus  阅读(275)  评论(0编辑  收藏  举报