diff --git a/chapter2/03_how_to_define_a_thread.rst b/chapter2/03_how_to_define_a_thread.rst index 72e8fc7..6f933a2 100644 --- a/chapter2/03_how_to_define_a_thread.rst +++ b/chapter2/03_how_to_define_a_thread.rst @@ -14,8 +14,8 @@ - ``group``: 一般设置为 ``None`` ,这是为以后的一些特性预留的 - ``target``: 当线程启动的时候要执行的函数 - ``name``: 线程的名字,默认会分配一个唯一名字 ``Thread-N`` -- ``args``: 传递给 ``target`` 的参数,要试用tuple类型 -- ``kwargs``: 同上,试用字典类型dict +- ``args``: 传递给 ``target`` 的参数,要使用tuple类型 +- ``kwargs``: 同上,使用字典类型dict 创建线程的方法非常实用,通过`target`参数、`arg`和`kwarg`告诉线程应该做什么。下面这个例子传递一个数字给线程(这个数字正好等于线程号码),目标函数会打印出这个数字。