@@ -31,37 +31,44 @@ msgid ""
3131"provided. The :mod:`threading` module provides an easier to use and higher-"
3232"level threading API built on top of this module."
3333msgstr ""
34+ "這個模組提供了與多個執行緒(也稱為:dfn:`輕量級行程` 或 :dfn: `任務`)一起工作"
35+ "的低階原始物件 --- 多個控制執行緒分享其全域資料空間。為了處理同步問題,也提供了簡"
36+ "單的鎖 (lock) 機制(也稱為:dfn:`互斥鎖` 或 :dfn:`二進位號誌`)。 :mod:"
37+ "`threading` 模組提供了一個建立在這個模組之上的更易於使用和高階的執行緒 API。"
3438
3539#: ../../library/_thread.rst:26
3640msgid "This module used to be optional, it is now always available."
37- msgstr ""
41+ msgstr "這個模組之前是可選擇性的,但現在已經是可用的。 "
3842
3943#: ../../library/_thread.rst:29
4044msgid "This module defines the following constants and functions:"
41- msgstr ""
45+ msgstr "這個模組定義了以下的常數和函式: "
4246
4347#: ../../library/_thread.rst:33
4448msgid "Raised on thread-specific errors."
45- msgstr ""
49+ msgstr "在執行緒相關的錯誤發生時引發。 "
4650
4751#: ../../library/_thread.rst:35
4852msgid "This is now a synonym of the built-in :exc:`RuntimeError`."
49- msgstr ""
53+ msgstr "現在是內建例外 :exc:`RuntimeError` 的別名。 "
5054
5155#: ../../library/_thread.rst:41
5256msgid "This is the type of lock objects."
53- msgstr ""
57+ msgstr "這是鎖物件的型別。 "
5458
5559#: ../../library/_thread.rst:46
5660msgid ""
5761"Start a new thread and return its identifier. The thread executes the "
5862"function *function* with the argument list *args* (which must be a tuple). "
5963"The optional *kwargs* argument specifies a dictionary of keyword arguments."
6064msgstr ""
65+ "開始一個新的執行緒並回傳其識別字 (identifier) 。該執行緒執行帶有引數列表 "
66+ "*args*(必須是一個 tuple(元組))的函式 *function*。可選的 *kwargs* 引數指定"
67+ "一個關鍵字引數的字典。"
6168
6269#: ../../library/_thread.rst:50
6370msgid "When the function returns, the thread silently exits."
64- msgstr ""
71+ msgstr "當函式回傳時,執行緒會靜默退出。 "
6572
6673#: ../../library/_thread.rst:52
6774msgid ""
@@ -70,64 +77,77 @@ msgid ""
7077"the hook argument is *function*. By default, a stack trace is printed and "
7178"then the thread exits (but other threads continue to run)."
7279msgstr ""
80+ "當函式因未處理的例外終止時,將呼叫 :func:`sys.unraisablehook` 來處理該例外。鉤"
81+ "子引數的 *object* 屬性是 *function*。預設情況下,會列印堆疊跟蹤,然後執行緒退"
82+ "出(但其他執行緒會繼續運行)。"
7383
7484#: ../../library/_thread.rst:57
7585msgid ""
7686"When the function raises a :exc:`SystemExit` exception, it is silently "
7787"ignored."
78- msgstr ""
88+ msgstr "當函式引發 :exc:`SystemExit` 例外時,它會被靜默忽略。 "
7989
8090#: ../../library/_thread.rst:60
8191msgid ""
8292"Raises an :ref:`auditing event <auditing>` ``_thread.start_new_thread`` with "
8393"arguments ``function``, ``args``, ``kwargs``."
8494msgstr ""
95+ "引發一個 :ref:`稽核事件 <auditing>` ``_thread.start_new_thread``,帶有引數 "
96+ "``function``、``args`` 和 ``kwargs``。"
8597
8698#: ../../library/_thread.rst:62
8799msgid ":func:`sys.unraisablehook` is now used to handle unhandled exceptions."
88- msgstr ""
100+ msgstr "現在使用 :func:`sys.unraisablehook` 來處理未處理的例外。 "
89101
90102#: ../../library/_thread.rst:68
91103msgid ""
92104"Simulate the effect of a signal arriving in the main thread. A thread can "
93105"use this function to interrupt the main thread, though there is no guarantee "
94106"that the interruption will happen immediately."
95107msgstr ""
108+ "模擬一個訊號到達主執行緒的效果。執行緒可以使用此函式來中斷主執行緒,但無法保"
109+ "證中斷會立即發生。"
96110
97111#: ../../library/_thread.rst:72
98112msgid ""
99113"If given, *signum* is the number of the signal to simulate. If *signum* is "
100114"not given, :const:`signal.SIGINT` is simulated."
101115msgstr ""
116+ "如果提供了 *signum*,則模擬指定的訊號編號。如果未提供 *signum*,則模擬 :"
117+ "const:`signal.SIGINT` 訊號。"
102118
103119#: ../../library/_thread.rst:75
104120msgid ""
105121"If the given signal isn't handled by Python (it was set to :const:`signal."
106122"SIG_DFL` or :const:`signal.SIG_IGN`), this function does nothing."
107123msgstr ""
124+ "如果給定的訊號在 Python 中未被處理(即設置為 :const:`signal.SIG_DFL` 或 :"
125+ "const:`signal.SIG_IGN`),此函式不做任何操作。"
108126
109127#: ../../library/_thread.rst:79
110128msgid "The *signum* argument is added to customize the signal number."
111- msgstr ""
129+ msgstr "新增了 *signum* 引數以自定義訊號編號。 "
112130
113131#: ../../library/_thread.rst:83
114132msgid ""
115133"This does not emit the corresponding signal but schedules a call to the "
116134"associated handler (if it exists). If you want to truly emit the signal, "
117135"use :func:`signal.raise_signal`."
118136msgstr ""
137+ "這並不會發出對應的訊號,而是安排呼叫相應的處理器(如果存在的話)。如果您想真"
138+ "正發出訊號,請使用 :func:`signal.raise_signal`。"
119139
120140#: ../../library/_thread.rst:90
121141msgid ""
122142"Raise the :exc:`SystemExit` exception. When not caught, this will cause the "
123143"thread to exit silently."
124- msgstr ""
144+ msgstr "引發 :exc:`SystemExit` 例外。當未捕獲時,將導致執行緒靜默退出。 "
125145
126146#: ../../library/_thread.rst:104
127147msgid ""
128148"Return a new lock object. Methods of locks are described below. The lock "
129149"is initially unlocked."
130- msgstr ""
150+ msgstr "回傳一個新的鎖物件。鎖物件的方法如下所述。初始狀況下鎖是解鎖狀態。 "
131151
132152#: ../../library/_thread.rst:110
133153msgid ""
@@ -137,6 +157,9 @@ msgid ""
137157"identifiers may be recycled when a thread exits and another thread is "
138158"created."
139159msgstr ""
160+ "回傳當前執行緒的「執行緒識別字」。這是一個非零的整數。它的值沒有直接的含義;"
161+ "它被用作一個 magic cookie,例如用於索引特定於執行緒的資料的字典。當執行緒退出"
162+ "並建立另一個執行緒時,執行緒識別字可能會被重複使用。"
140163
141164#: ../../library/_thread.rst:118
142165msgid ""
@@ -145,6 +168,9 @@ msgid ""
145168"identify this particular thread system-wide (until the thread terminates, "
146169"after which the value may be recycled by the OS)."
147170msgstr ""
171+ "回傳由核心 (kernel) 分配的當前執行緒的原生整數執行緒 ID。這是一個非負整數。它"
172+ "的值可用於在整個系統中唯一標識此特定執行緒(直到執行緒終止後,該值可能被操作"
173+ "系統重新使用)。"
148174
149175#: ../../library/_thread.rst:123
150176msgid ""
@@ -172,25 +198,36 @@ msgid ""
172198"stack size is the suggested approach in the absence of more specific "
173199"information)."
174200msgstr ""
201+ "回傳在建立新執行緒時使用的執行緒堆疊大小。可選的 *size* 引數指定了隨後建立的"
202+ "執行緒要使用的堆疊大小,必須是 0(使用平台或配置的預設值)或至少 32,768(32 "
203+ "KiB)的正整數值。如果未指定 *size*,則使用 0。如果不支持更改執行緒堆疊大小,"
204+ "則會引發 :exc:`RuntimeError` 錯誤。如果指定的堆疊大小無效,則會引發 :exc:"
205+ "`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證解譯器本身具有"
206+ "足夠堆疊空間所支持的最小堆疊大小值。請注意,某些平台對於堆疊大小的值可能有特"
207+ "定的限制,例如要求最小堆疊大小 > 32 KiB,或要求按系統記憶體頁面大小的倍數進行"
208+ "分配。應參考平台文檔以獲取更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息"
209+ "的情況下,建議使用 4096 的倍數作為堆疊大小)。"
175210
176211#: ../../library/_thread.rst:145
177212msgid ":ref:`Availability <availability>`: Windows, pthreads."
178213msgstr ":ref:`適用 <availability>`:Windows, pthreads。"
179214
180215#: ../../library/_thread.rst:147
181216msgid "Unix platforms with POSIX threads support."
182- msgstr ""
217+ msgstr "Unix 平台上支援 POSIX 執行緒。 "
183218
184219#: ../../library/_thread.rst:152
185220msgid ""
186221"The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire "
187222"<threading.Lock.acquire>`. Specifying a timeout greater than this value will "
188223"raise an :exc:`OverflowError`."
189224msgstr ""
225+ ":meth:`Lock.acquire <threading.Lock.acquire>` 的 *timeout* 參數所允許的最大"
226+ "值。指定超過此值的 timeout 將引發 :exc:`OverflowError` 錯誤。"
190227
191228#: ../../library/_thread.rst:159
192229msgid "Lock objects have the following methods:"
193- msgstr ""
230+ msgstr "鎖物件具有以下方法: "
194231
195232#: ../../library/_thread.rst:164
196233msgid ""
@@ -199,6 +236,8 @@ msgid ""
199236"(only one thread at a time can acquire a lock --- that's their reason for "
200237"existence)."
201238msgstr ""
239+ "沒有任何可選引數時,此方法無條件地獲取鎖,必要時會等待直到被另一個執行緒釋放"
240+ "(一次只能有一個執行緒獲取鎖 --- 這正是鎖存在的原因)。"
202241
203242#: ../../library/_thread.rst:168
204243msgid ""
@@ -207,6 +246,8 @@ msgid ""
207246"without waiting, while if it is true, the lock is acquired unconditionally "
208247"as above."
209248msgstr ""
249+ "如果存在 *blocking* 引數,則根據其值執行操作:如果為 False,只有在可以立即獲"
250+ "取鎖而無需等待的情況下才獲取鎖,而如果為 True,則像上面一樣無條件地獲取鎖。"
210251
211252#: ../../library/_thread.rst:173
212253msgid ""
@@ -215,100 +256,116 @@ msgid ""
215256"*timeout* argument specifies an unbounded wait. You cannot specify a "
216257"*timeout* if *blocking* is false."
217258msgstr ""
259+ "如果存在浮點數的 *timeout* 引數且為正值,則它指定了在回傳之前的最大等待時間"
260+ "(以秒為單位)。如果 *timeout* 引數為負值,則表示等待時間會無限期地等待。如"
261+ "果 *blocking* 為 False,則你無法指定 *timeout*。"
218262
219263#: ../../library/_thread.rst:178
220264msgid ""
221265"The return value is ``True`` if the lock is acquired successfully, ``False`` "
222266"if not."
223- msgstr ""
267+ msgstr "如果成功獲取鎖,回傳值為 ``True``,否則為 ``False``。 "
224268
225269#: ../../library/_thread.rst:181
226270msgid "The *timeout* parameter is new."
227- msgstr ""
271+ msgstr "新增的 *timeout* 參數。 "
228272
229273#: ../../library/_thread.rst:184
230274msgid "Lock acquires can now be interrupted by signals on POSIX."
231- msgstr ""
275+ msgstr "現在獲取鎖的操作可以被 POSIX 訊號中斷。 "
232276
233277#: ../../library/_thread.rst:190
234278msgid ""
235279"Releases the lock. The lock must have been acquired earlier, but not "
236280"necessarily by the same thread."
237- msgstr ""
281+ msgstr "釋放鎖。鎖必須先前被獲取,但不一定是由同一個執行緒獲取的。 "
238282
239283#: ../../library/_thread.rst:196
240284msgid ""
241285"Return the status of the lock: ``True`` if it has been acquired by some "
242286"thread, ``False`` if not."
243287msgstr ""
288+ "回傳鎖的狀態:如果鎖已被某個執行緒獲取,則回傳 ``True``,否則回傳 ``False``。"
244289
245290#: ../../library/_thread.rst:199
246291msgid ""
247292"In addition to these methods, lock objects can also be used via the :keyword:"
248293"`with` statement, e.g.::"
249- msgstr ""
294+ msgstr "除了這些方法之外,鎖物件還可以透過 :keyword:`with` 語句來使用,例如: "
250295
251296#: ../../library/_thread.rst:209
252297msgid "**Caveats:**"
253- msgstr ""
298+ msgstr "**注意事項:** "
254299
255300#: ../../library/_thread.rst:213
256301msgid ""
257302"Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` "
258303"exception will be received by an arbitrary thread. (When the :mod:`signal` "
259304"module is available, interrupts always go to the main thread.)"
260305msgstr ""
306+ "執行緒與中斷的互動可能會有奇怪的情況:任何一個執行緒都有可能收到 :exc:"
307+ "`KeyboardInterrupt` 例外。(當 :mod:`signal` 模組可用時,中斷總是會進入主執行"
308+ "緒。)"
261309
262310#: ../../library/_thread.rst:217
263311msgid ""
264312"Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is "
265313"equivalent to calling :func:`_thread.exit`."
266314msgstr ""
315+ "呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:"
316+ "`_thread.exit` 函式。"
267317
268318#: ../../library/_thread.rst:220
269319msgid ""
270320"It is not possible to interrupt the :meth:`~threading.Lock.acquire` method "
271321"on a lock --- the :exc:`KeyboardInterrupt` exception will happen after the "
272322"lock has been acquired."
273323msgstr ""
324+ "無法在鎖的 :meth:`~threading.Lock.acquire` 方法上中斷執行, :exc:"
325+ "`KeyboardInterrupt` 例外會在鎖被獲取後發生。"
274326
275327#: ../../library/_thread.rst:224
276328msgid ""
277329"When the main thread exits, it is system defined whether the other threads "
278330"survive. On most systems, they are killed without executing :keyword:"
279331"`try` ... :keyword:`finally` clauses or executing object destructors."
280332msgstr ""
333+ "當主執行緒退出時,其他執行緒是否保留是由系統決定的。在大多數系統上,它們將被"
334+ "終止,而不會執行 :keyword:`try` ... :keyword:`finally` 子句或執行物件的解構函"
335+ "式。"
281336
282337#: ../../library/_thread.rst:229
283338msgid ""
284339"When the main thread exits, it does not do any of its usual cleanup (except "
285340"that :keyword:`try` ... :keyword:`finally` clauses are honored), and the "
286341"standard I/O files are not flushed."
287342msgstr ""
343+ "當主執行緒退出時,它不會執行任何通常的清理操作(除非有 :keyword:`try` ... :"
344+ "keyword:`finally` 子句),並且標準 I/O 檔案不會被刷新。"
288345
289346#: ../../library/_thread.rst:7
290347msgid "light-weight processes"
291- msgstr ""
348+ msgstr "light-weight processes(輕量級行程) "
292349
293350#: ../../library/_thread.rst:7
294351msgid "processes, light-weight"
295- msgstr ""
352+ msgstr "processes, light-weight(行程,輕量級) "
296353
297354#: ../../library/_thread.rst:7
298355msgid "binary semaphores"
299- msgstr ""
356+ msgstr "binary semaphores(二進位號誌) "
300357
301358#: ../../library/_thread.rst:7
302359msgid "semaphores, binary"
303- msgstr ""
360+ msgstr "semaphores, binary(號誌,二進位) "
304361
305362#: ../../library/_thread.rst:22
306363msgid "pthreads"
307- msgstr ""
364+ msgstr "pthreads "
308365
309366#: ../../library/_thread.rst:22
310367msgid "threads"
311- msgstr ""
368+ msgstr "threads(執行緒) "
312369
313370#: ../../library/_thread.rst:22
314371msgid "POSIX"