@@ -10,6 +10,7 @@ msgstr ""
1010"Report-Msgid-Bugs-To : \n "
1111"POT-Creation-Date : 2018-06-30 05:56+0900\n "
1212"PO-Revision-Date : YEAR-MO-DA HO:MI+ZONE\n "
13+ "
Last-Translator :
cissoid <[email protected] >, 2018\n "
1314"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
1415"MIME-Version : 1.0\n "
1516"Content-Type : text/plain; charset=UTF-8\n "
@@ -19,7 +20,7 @@ msgstr ""
1920
2021#: ../../library/_thread.rst:2
2122msgid ":mod:`_thread` --- Low-level threading API"
22- msgstr ""
23+ msgstr ":mod:`_thread` —— 底层多线程 API "
2324
2425#: ../../library/_thread.rst:15
2526msgid ""
@@ -30,26 +31,29 @@ msgid ""
3031"provided. The :mod:`threading` module provides an easier to use and higher-"
3132"level threading API built on top of this module."
3233msgstr ""
34+ "该模块提供了操作多个线程(也被称为 :dfn:`轻量级进程` 或 :dfn:`任务`)的底层原语 —— "
35+ "多个控制线程共享全局数据空间。为了处理同步问题,也提供了简单的锁机制(也称为 :dfn:`互斥锁` 或 "
36+ ":dfn:`二进制信号`)。:mod:`threading` 模块基于该模块提供了更易用的高级多线程 API。"
3337
3438#: ../../library/_thread.rst:26
3539msgid "This module used to be optional, it is now always available."
36- msgstr ""
40+ msgstr "这个模块曾经是可选的,但现在总是可用的。 "
3741
3842#: ../../library/_thread.rst:29
3943msgid "This module defines the following constants and functions:"
40- msgstr ""
44+ msgstr "这个模块定义了以下常量和函数: "
4145
4246#: ../../library/_thread.rst:33
4347msgid "Raised on thread-specific errors."
44- msgstr ""
48+ msgstr "发生线程相关错误时抛出。 "
4549
4650#: ../../library/_thread.rst:35
4751msgid "This is now a synonym of the built-in :exc:`RuntimeError`."
48- msgstr ""
52+ msgstr "现在是内建异常 :exc:`RuntimeError` 的别名。 "
4953
5054#: ../../library/_thread.rst:41
5155msgid "This is the type of lock objects."
52- msgstr ""
56+ msgstr "锁对象的类型。 "
5357
5458#: ../../library/_thread.rst:46
5559msgid ""
@@ -60,24 +64,26 @@ msgid ""
6064"terminates with an unhandled exception, a stack trace is printed and then "
6165"the thread exits (but other threads continue to run)."
6266msgstr ""
67+ "启动一个线程,并返回其标识符。线程会用 *args* 作为参数(必须是元组)执行 *function* 函数。可选的 *kwargs* "
68+ "参数使用字典来指定有名参数。当函数返回时,线程会静默退出,当函数由于未处理的异常而中止时,会打印一条堆栈追踪信息,然后该线程会退出(但其他线程还是会继续运行)。"
6369
6470#: ../../library/_thread.rst:56
6571msgid ""
6672"Raise a :exc:`KeyboardInterrupt` exception in the main thread. A subthread "
6773"can use this function to interrupt the main thread."
68- msgstr ""
74+ msgstr "在主线程中抛出 :exc:`KeyboardInterrupt` 异常。子线程可以使用这个函数来中断主线程。 "
6975
7076#: ../../library/_thread.rst:62
7177msgid ""
7278"Raise the :exc:`SystemExit` exception. When not caught, this will cause the"
7379" thread to exit silently."
74- msgstr ""
80+ msgstr "抛出 :exc:`SystemExit` 异常。如果没有捕获的话,这个异常会使线程退出。 "
7581
7682#: ../../library/_thread.rst:76
7783msgid ""
7884"Return a new lock object. Methods of locks are described below. The lock "
7985"is initially unlocked."
80- msgstr ""
86+ msgstr "返回一个新的锁对象。锁中的方法在后面描述。初始情况下锁处于解锁状态。 "
8187
8288#: ../../library/_thread.rst:82
8389msgid ""
@@ -87,6 +93,8 @@ msgid ""
8793"identifiers may be recycled when a thread exits and another thread is "
8894"created."
8995msgstr ""
96+ "返回当前线程的 “线程描述符”。它是一个非零的整型数。它的值没有什么含义,主要是作为 magic cookie "
97+ "使用,比如作为含有线程相关数据的字典的索引。线程描述符可能会在线程退出,新线程创建时复用。"
9098
9199#: ../../library/_thread.rst:90
92100msgid ""
@@ -106,13 +114,21 @@ msgid ""
106114"stack size is the suggested approach in the absence of more specific "
107115"information). Availability: Windows, systems with POSIX threads."
108116msgstr ""
117+ "返回创建线程时使用的线程堆栈大小。可选的 *size* 参数可以指定后续创建线程时是用的堆栈大小,但是必须传 0(使用平台或配置的默认值)或是大于等于 "
118+ "32768 的正整数(32 KiB)。如果没有传 *size*,默认会使用 0。如果不支持修改线程堆栈大小的话,会抛出 "
119+ ":exc:`RuntimeError` 异常。如果传入的堆栈大小不合法,会抛出 :exc:`ValueError` 异常,同时堆栈大小会保持不变。目前 "
120+ "32 KiB 是保证解释器本身足够使用的最小堆栈大小。注意某些平台可能会对堆栈大小有特别的限制,比如需要最小堆栈大小 > 32 KiB "
121+ "或是需要申请系统内存页整数倍大小的内存 —— 平台文档中应该可以找到更多相关信息(4 KiB 比较常见,在没有更多信息时使用 4096 "
122+ "的整倍数作为堆栈大小是个不错的选择。可以用于:Windows,使用 POSIX 线程的系统。"
109123
110124#: ../../library/_thread.rst:109
111125msgid ""
112126"The maximum value allowed for the *timeout* parameter of "
113127":meth:`Lock.acquire`. Specifying a timeout greater than this value will "
114128"raise an :exc:`OverflowError`."
115129msgstr ""
130+ ":meth:`Lock.acquire` 方法中 *timeout* 参数允许的最大值。传入超过这个值的 timeout 会抛出 "
131+ ":exc:`OverflowError` 异常。"
116132
117133#: ../../library/_thread.rst:116
118134msgid "Lock objects have the following methods:"
0 commit comments