@@ -31,37 +31,44 @@ msgid ""
31
31
"provided. The :mod:`threading` module provides an easier to use and higher-"
32
32
"level threading API built on top of this module."
33
33
msgstr ""
34
+ "這個模組提供了與多個執行緒(也稱為:dfn:`輕量級行程` 或 :dfn: `任務`)一起工作"
35
+ "的低階原始物件 --- 多個控制執行緒分享其全域資料空間。為了處理同步問題,也提供了簡"
36
+ "單的鎖 (lock) 機制(也稱為:dfn:`互斥鎖` 或 :dfn:`二進位號誌`)。 :mod:"
37
+ "`threading` 模組提供了一個建立在這個模組之上的更易於使用和高階的執行緒 API。"
34
38
35
39
#: ../../library/_thread.rst:26
36
40
msgid "This module used to be optional, it is now always available."
37
- msgstr ""
41
+ msgstr "這個模組之前是可選擇性的,但現在已經是可用的。 "
38
42
39
43
#: ../../library/_thread.rst:29
40
44
msgid "This module defines the following constants and functions:"
41
- msgstr ""
45
+ msgstr "這個模組定義了以下的常數和函式: "
42
46
43
47
#: ../../library/_thread.rst:33
44
48
msgid "Raised on thread-specific errors."
45
- msgstr ""
49
+ msgstr "在執行緒相關的錯誤發生時引發。 "
46
50
47
51
#: ../../library/_thread.rst:35
48
52
msgid "This is now a synonym of the built-in :exc:`RuntimeError`."
49
- msgstr ""
53
+ msgstr "現在是內建例外 :exc:`RuntimeError` 的別名。 "
50
54
51
55
#: ../../library/_thread.rst:41
52
56
msgid "This is the type of lock objects."
53
- msgstr ""
57
+ msgstr "這是鎖物件的型別。 "
54
58
55
59
#: ../../library/_thread.rst:46
56
60
msgid ""
57
61
"Start a new thread and return its identifier. The thread executes the "
58
62
"function *function* with the argument list *args* (which must be a tuple). "
59
63
"The optional *kwargs* argument specifies a dictionary of keyword arguments."
60
64
msgstr ""
65
+ "開始一個新的執行緒並回傳其識別字 (identifier) 。該執行緒執行帶有引數列表 "
66
+ "*args*(必須是一個 tuple(元組))的函式 *function*。可選的 *kwargs* 引數指定"
67
+ "一個關鍵字引數的字典。"
61
68
62
69
#: ../../library/_thread.rst:50
63
70
msgid "When the function returns, the thread silently exits."
64
- msgstr ""
71
+ msgstr "當函式回傳時,執行緒會靜默退出。 "
65
72
66
73
#: ../../library/_thread.rst:52
67
74
msgid ""
@@ -70,64 +77,77 @@ msgid ""
70
77
"the hook argument is *function*. By default, a stack trace is printed and "
71
78
"then the thread exits (but other threads continue to run)."
72
79
msgstr ""
80
+ "當函式因未處理的例外終止時,將呼叫 :func:`sys.unraisablehook` 來處理該例外。鉤"
81
+ "子引數的 *object* 屬性是 *function*。預設情況下,會列印堆疊跟蹤,然後執行緒退"
82
+ "出(但其他執行緒會繼續運行)。"
73
83
74
84
#: ../../library/_thread.rst:57
75
85
msgid ""
76
86
"When the function raises a :exc:`SystemExit` exception, it is silently "
77
87
"ignored."
78
- msgstr ""
88
+ msgstr "當函式引發 :exc:`SystemExit` 例外時,它會被靜默忽略。 "
79
89
80
90
#: ../../library/_thread.rst:60
81
91
msgid ""
82
92
"Raises an :ref:`auditing event <auditing>` ``_thread.start_new_thread`` with "
83
93
"arguments ``function``, ``args``, ``kwargs``."
84
94
msgstr ""
95
+ "引發一個 :ref:`稽核事件 <auditing>` ``_thread.start_new_thread``,帶有引數 "
96
+ "``function``、``args`` 和 ``kwargs``。"
85
97
86
98
#: ../../library/_thread.rst:62
87
99
msgid ":func:`sys.unraisablehook` is now used to handle unhandled exceptions."
88
- msgstr ""
100
+ msgstr "現在使用 :func:`sys.unraisablehook` 來處理未處理的例外。 "
89
101
90
102
#: ../../library/_thread.rst:68
91
103
msgid ""
92
104
"Simulate the effect of a signal arriving in the main thread. A thread can "
93
105
"use this function to interrupt the main thread, though there is no guarantee "
94
106
"that the interruption will happen immediately."
95
107
msgstr ""
108
+ "模擬一個訊號到達主執行緒的效果。執行緒可以使用此函式來中斷主執行緒,但無法保"
109
+ "證中斷會立即發生。"
96
110
97
111
#: ../../library/_thread.rst:72
98
112
msgid ""
99
113
"If given, *signum* is the number of the signal to simulate. If *signum* is "
100
114
"not given, :const:`signal.SIGINT` is simulated."
101
115
msgstr ""
116
+ "如果提供了 *signum*,則模擬指定的訊號編號。如果未提供 *signum*,則模擬 :"
117
+ "const:`signal.SIGINT` 訊號。"
102
118
103
119
#: ../../library/_thread.rst:75
104
120
msgid ""
105
121
"If the given signal isn't handled by Python (it was set to :const:`signal."
106
122
"SIG_DFL` or :const:`signal.SIG_IGN`), this function does nothing."
107
123
msgstr ""
124
+ "如果給定的訊號在 Python 中未被處理(即設置為 :const:`signal.SIG_DFL` 或 :"
125
+ "const:`signal.SIG_IGN`),此函式不做任何操作。"
108
126
109
127
#: ../../library/_thread.rst:79
110
128
msgid "The *signum* argument is added to customize the signal number."
111
- msgstr ""
129
+ msgstr "新增了 *signum* 引數以自定義訊號編號。 "
112
130
113
131
#: ../../library/_thread.rst:83
114
132
msgid ""
115
133
"This does not emit the corresponding signal but schedules a call to the "
116
134
"associated handler (if it exists). If you want to truly emit the signal, "
117
135
"use :func:`signal.raise_signal`."
118
136
msgstr ""
137
+ "這並不會發出對應的訊號,而是安排呼叫相應的處理器(如果存在的話)。如果您想真"
138
+ "正發出訊號,請使用 :func:`signal.raise_signal`。"
119
139
120
140
#: ../../library/_thread.rst:90
121
141
msgid ""
122
142
"Raise the :exc:`SystemExit` exception. When not caught, this will cause the "
123
143
"thread to exit silently."
124
- msgstr ""
144
+ msgstr "引發 :exc:`SystemExit` 例外。當未捕獲時,將導致執行緒靜默退出。 "
125
145
126
146
#: ../../library/_thread.rst:104
127
147
msgid ""
128
148
"Return a new lock object. Methods of locks are described below. The lock "
129
149
"is initially unlocked."
130
- msgstr ""
150
+ msgstr "回傳一個新的鎖物件。鎖物件的方法如下所述。初始狀況下鎖是解鎖狀態。 "
131
151
132
152
#: ../../library/_thread.rst:110
133
153
msgid ""
@@ -137,6 +157,9 @@ msgid ""
137
157
"identifiers may be recycled when a thread exits and another thread is "
138
158
"created."
139
159
msgstr ""
160
+ "回傳當前執行緒的「執行緒識別字」。這是一個非零的整數。它的值沒有直接的含義;"
161
+ "它被用作一個 magic cookie,例如用於索引特定於執行緒的資料的字典。當執行緒退出"
162
+ "並建立另一個執行緒時,執行緒識別字可能會被重複使用。"
140
163
141
164
#: ../../library/_thread.rst:118
142
165
msgid ""
@@ -145,6 +168,9 @@ msgid ""
145
168
"identify this particular thread system-wide (until the thread terminates, "
146
169
"after which the value may be recycled by the OS)."
147
170
msgstr ""
171
+ "回傳由核心 (kernel) 分配的當前執行緒的原生整數執行緒 ID。這是一個非負整數。它"
172
+ "的值可用於在整個系統中唯一標識此特定執行緒(直到執行緒終止後,該值可能被操作"
173
+ "系統重新使用)。"
148
174
149
175
#: ../../library/_thread.rst:123
150
176
msgid ""
@@ -172,25 +198,36 @@ msgid ""
172
198
"stack size is the suggested approach in the absence of more specific "
173
199
"information)."
174
200
msgstr ""
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 的倍數作為堆疊大小)。"
175
210
176
211
#: ../../library/_thread.rst:145
177
212
msgid ":ref:`Availability <availability>`: Windows, pthreads."
178
213
msgstr ":ref:`適用 <availability>`:Windows, pthreads。"
179
214
180
215
#: ../../library/_thread.rst:147
181
216
msgid "Unix platforms with POSIX threads support."
182
- msgstr ""
217
+ msgstr "Unix 平台上支援 POSIX 執行緒。 "
183
218
184
219
#: ../../library/_thread.rst:152
185
220
msgid ""
186
221
"The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire "
187
222
"<threading.Lock.acquire>`. Specifying a timeout greater than this value will "
188
223
"raise an :exc:`OverflowError`."
189
224
msgstr ""
225
+ ":meth:`Lock.acquire <threading.Lock.acquire>` 的 *timeout* 參數所允許的最大"
226
+ "值。指定超過此值的 timeout 將引發 :exc:`OverflowError` 錯誤。"
190
227
191
228
#: ../../library/_thread.rst:159
192
229
msgid "Lock objects have the following methods:"
193
- msgstr ""
230
+ msgstr "鎖物件具有以下方法: "
194
231
195
232
#: ../../library/_thread.rst:164
196
233
msgid ""
@@ -199,6 +236,8 @@ msgid ""
199
236
"(only one thread at a time can acquire a lock --- that's their reason for "
200
237
"existence)."
201
238
msgstr ""
239
+ "沒有任何可選引數時,此方法無條件地獲取鎖,必要時會等待直到被另一個執行緒釋放"
240
+ "(一次只能有一個執行緒獲取鎖 --- 這正是鎖存在的原因)。"
202
241
203
242
#: ../../library/_thread.rst:168
204
243
msgid ""
@@ -207,6 +246,8 @@ msgid ""
207
246
"without waiting, while if it is true, the lock is acquired unconditionally "
208
247
"as above."
209
248
msgstr ""
249
+ "如果存在 *blocking* 引數,則根據其值執行操作:如果為 False,只有在可以立即獲"
250
+ "取鎖而無需等待的情況下才獲取鎖,而如果為 True,則像上面一樣無條件地獲取鎖。"
210
251
211
252
#: ../../library/_thread.rst:173
212
253
msgid ""
@@ -215,100 +256,116 @@ msgid ""
215
256
"*timeout* argument specifies an unbounded wait. You cannot specify a "
216
257
"*timeout* if *blocking* is false."
217
258
msgstr ""
259
+ "如果存在浮點數的 *timeout* 引數且為正值,則它指定了在回傳之前的最大等待時間"
260
+ "(以秒為單位)。如果 *timeout* 引數為負值,則表示等待時間會無限期地等待。如"
261
+ "果 *blocking* 為 False,則你無法指定 *timeout*。"
218
262
219
263
#: ../../library/_thread.rst:178
220
264
msgid ""
221
265
"The return value is ``True`` if the lock is acquired successfully, ``False`` "
222
266
"if not."
223
- msgstr ""
267
+ msgstr "如果成功獲取鎖,回傳值為 ``True``,否則為 ``False``。 "
224
268
225
269
#: ../../library/_thread.rst:181
226
270
msgid "The *timeout* parameter is new."
227
- msgstr ""
271
+ msgstr "新增的 *timeout* 參數。 "
228
272
229
273
#: ../../library/_thread.rst:184
230
274
msgid "Lock acquires can now be interrupted by signals on POSIX."
231
- msgstr ""
275
+ msgstr "現在獲取鎖的操作可以被 POSIX 訊號中斷。 "
232
276
233
277
#: ../../library/_thread.rst:190
234
278
msgid ""
235
279
"Releases the lock. The lock must have been acquired earlier, but not "
236
280
"necessarily by the same thread."
237
- msgstr ""
281
+ msgstr "釋放鎖。鎖必須先前被獲取,但不一定是由同一個執行緒獲取的。 "
238
282
239
283
#: ../../library/_thread.rst:196
240
284
msgid ""
241
285
"Return the status of the lock: ``True`` if it has been acquired by some "
242
286
"thread, ``False`` if not."
243
287
msgstr ""
288
+ "回傳鎖的狀態:如果鎖已被某個執行緒獲取,則回傳 ``True``,否則回傳 ``False``。"
244
289
245
290
#: ../../library/_thread.rst:199
246
291
msgid ""
247
292
"In addition to these methods, lock objects can also be used via the :keyword:"
248
293
"`with` statement, e.g.::"
249
- msgstr ""
294
+ msgstr "除了這些方法之外,鎖物件還可以透過 :keyword:`with` 語句來使用,例如: "
250
295
251
296
#: ../../library/_thread.rst:209
252
297
msgid "**Caveats:**"
253
- msgstr ""
298
+ msgstr "**注意事項:** "
254
299
255
300
#: ../../library/_thread.rst:213
256
301
msgid ""
257
302
"Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` "
258
303
"exception will be received by an arbitrary thread. (When the :mod:`signal` "
259
304
"module is available, interrupts always go to the main thread.)"
260
305
msgstr ""
306
+ "執行緒與中斷的互動可能會有奇怪的情況:任何一個執行緒都有可能收到 :exc:"
307
+ "`KeyboardInterrupt` 例外。(當 :mod:`signal` 模組可用時,中斷總是會進入主執行"
308
+ "緒。)"
261
309
262
310
#: ../../library/_thread.rst:217
263
311
msgid ""
264
312
"Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is "
265
313
"equivalent to calling :func:`_thread.exit`."
266
314
msgstr ""
315
+ "呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:"
316
+ "`_thread.exit` 函式。"
267
317
268
318
#: ../../library/_thread.rst:220
269
319
msgid ""
270
320
"It is not possible to interrupt the :meth:`~threading.Lock.acquire` method "
271
321
"on a lock --- the :exc:`KeyboardInterrupt` exception will happen after the "
272
322
"lock has been acquired."
273
323
msgstr ""
324
+ "無法在鎖的 :meth:`~threading.Lock.acquire` 方法上中斷執行, :exc:"
325
+ "`KeyboardInterrupt` 例外會在鎖被獲取後發生。"
274
326
275
327
#: ../../library/_thread.rst:224
276
328
msgid ""
277
329
"When the main thread exits, it is system defined whether the other threads "
278
330
"survive. On most systems, they are killed without executing :keyword:"
279
331
"`try` ... :keyword:`finally` clauses or executing object destructors."
280
332
msgstr ""
333
+ "當主執行緒退出時,其他執行緒是否保留是由系統決定的。在大多數系統上,它們將被"
334
+ "終止,而不會執行 :keyword:`try` ... :keyword:`finally` 子句或執行物件的解構函"
335
+ "式。"
281
336
282
337
#: ../../library/_thread.rst:229
283
338
msgid ""
284
339
"When the main thread exits, it does not do any of its usual cleanup (except "
285
340
"that :keyword:`try` ... :keyword:`finally` clauses are honored), and the "
286
341
"standard I/O files are not flushed."
287
342
msgstr ""
343
+ "當主執行緒退出時,它不會執行任何通常的清理操作(除非有 :keyword:`try` ... :"
344
+ "keyword:`finally` 子句),並且標準 I/O 檔案不會被刷新。"
288
345
289
346
#: ../../library/_thread.rst:7
290
347
msgid "light-weight processes"
291
- msgstr ""
348
+ msgstr "light-weight processes(輕量級行程) "
292
349
293
350
#: ../../library/_thread.rst:7
294
351
msgid "processes, light-weight"
295
- msgstr ""
352
+ msgstr "processes, light-weight(行程,輕量級) "
296
353
297
354
#: ../../library/_thread.rst:7
298
355
msgid "binary semaphores"
299
- msgstr ""
356
+ msgstr "binary semaphores(二進位號誌) "
300
357
301
358
#: ../../library/_thread.rst:7
302
359
msgid "semaphores, binary"
303
- msgstr ""
360
+ msgstr "semaphores, binary(號誌,二進位) "
304
361
305
362
#: ../../library/_thread.rst:22
306
363
msgid "pthreads"
307
- msgstr ""
364
+ msgstr "pthreads "
308
365
309
366
#: ../../library/_thread.rst:22
310
367
msgid "threads"
311
- msgstr ""
368
+ msgstr "threads(執行緒) "
312
369
313
370
#: ../../library/_thread.rst:22
314
371
msgid "POSIX"