@@ -132,15 +132,15 @@ msgstr ""
132132
133133#: ../../library/_thread.rst:116
134134msgid "Lock objects have the following methods:"
135- msgstr ""
135+ msgstr "锁对象有以下方法: "
136136
137137#: ../../library/_thread.rst:121
138138msgid ""
139139"Without any optional argument, this method acquires the lock "
140140"unconditionally, if necessary waiting until it is released by another thread"
141141" (only one thread at a time can acquire a lock --- that's their reason for "
142142"existence)."
143- msgstr ""
143+ msgstr "没有任何可选参数时,该方法无条件申请获得锁,有必要的话会等待其他线程释放锁(同时只有一个线程能获得锁 —— 这正是锁存在的原因)。 "
144144
145145#: ../../library/_thread.rst:125
146146msgid ""
@@ -149,6 +149,8 @@ msgid ""
149149"immediately without waiting, while if it is nonzero, the lock is acquired "
150150"unconditionally as above."
151151msgstr ""
152+ "如果传入了整型参数 *waitflag*,具体的行为取决于传入的值:如果是 0 "
153+ "的话,只会在能够立刻获取到锁时才获取,不会等待,如果是非零的话,会像之前提到的一样,无条件获取锁。"
152154
153155#: ../../library/_thread.rst:130
154156msgid ""
@@ -157,73 +159,82 @@ msgid ""
157159"*timeout* argument specifies an unbounded wait. You cannot specify a "
158160"*timeout* if *waitflag* is zero."
159161msgstr ""
162+ "如果传入正浮点数参数 *timeout*,相当于指定了返回之前等待得最大秒数。如果传入负的 *timeout*,相当于无限期等待。如果 "
163+ "*waitflag* 是 0 的话,不能指定 *timeout*。"
160164
161165#: ../../library/_thread.rst:135
162166msgid ""
163167"The return value is ``True`` if the lock is acquired successfully, ``False``"
164168" if not."
165- msgstr ""
169+ msgstr "如果成功获取到所会返回 ``True``,否则返回 ``False``。 "
166170
167171#: ../../library/_thread.rst:138
168172msgid "The *timeout* parameter is new."
169- msgstr ""
173+ msgstr "新的 *timeout` 参数。 "
170174
171175#: ../../library/_thread.rst:141
172176msgid "Lock acquires can now be interrupted by signals on POSIX."
173- msgstr ""
177+ msgstr "现在获取锁的操作可以被 POSIX 信号中断。 "
174178
175179#: ../../library/_thread.rst:147
176180msgid ""
177181"Releases the lock. The lock must have been acquired earlier, but not "
178182"necessarily by the same thread."
179- msgstr ""
183+ msgstr "释放锁。锁必须已经被获取过,但不一定是同一个线程获取的。 "
180184
181185#: ../../library/_thread.rst:153
182186msgid ""
183187"Return the status of the lock: ``True`` if it has been acquired by some "
184188"thread, ``False`` if not."
185- msgstr ""
189+ msgstr "返回锁的状态:如果已被某个线程获取,返回 ``True``,否则返回 ``False``。 "
186190
187191#: ../../library/_thread.rst:156
188192msgid ""
189193"In addition to these methods, lock objects can also be used via the "
190194":keyword:`with` statement, e.g.::"
191- msgstr ""
195+ msgstr "除了这些方法之外,锁对象也可以通过 :keyword:`with` 语句使用,例如: "
192196
193197#: ../../library/_thread.rst:166
194198msgid "**Caveats:**"
195- msgstr ""
199+ msgstr "**注意事项:** "
196200
197201#: ../../library/_thread.rst:170
198202msgid ""
199203"Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` "
200204"exception will be received by an arbitrary thread. (When the :mod:`signal` "
201205"module is available, interrupts always go to the main thread.)"
202206msgstr ""
207+ "线程与中断奇怪地交互::exc:`KeyboardInterrupt` 异常可能会被任意一个线程捕获。(如果 :mod:`signal` "
208+ "模块可用的话,中断总是会进入主线程。)"
203209
204210#: ../../library/_thread.rst:174
205211msgid ""
206212"Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is "
207213"equivalent to calling :func:`_thread.exit`."
208214msgstr ""
215+ "调用 :func:`sys.exit` 或是抛出 :exc:`SystemExit` 异常等效于调用 :func:`_thread.exit`。"
209216
210217#: ../../library/_thread.rst:177
211218msgid ""
212219"It is not possible to interrupt the :meth:`acquire` method on a lock --- the"
213220" :exc:`KeyboardInterrupt` exception will happen after the lock has been "
214221"acquired."
215- msgstr ""
222+ msgstr "不可能中断锁的 :meth:`acquire` 方法 —— :exc:`KeyboardInterrupt` 一场会在锁获取到之后发生。 "
216223
217224#: ../../library/_thread.rst:180
218225msgid ""
219226"When the main thread exits, it is system defined whether the other threads "
220227"survive. On most systems, they are killed without executing :keyword:`try` "
221228"... :keyword:`finally` clauses or executing object destructors."
222229msgstr ""
230+ "当主线程退出时,由系统决定其他线程是否存活。在大多数系统中,这些线程会直接被杀掉,不会执行 :keyword:`try` ... "
231+ ":keyword:`finally` 语句,也不会执行对象析构函数。"
223232
224233#: ../../library/_thread.rst:185
225234msgid ""
226235"When the main thread exits, it does not do any of its usual cleanup (except "
227236"that :keyword:`try` ... :keyword:`finally` clauses are honored), and the "
228237"standard I/O files are not flushed."
229238msgstr ""
239+ "当主线程退出时,不会进行正常的清理工作(除非使用了 :keyword:`try` ... :keyword:`finally` 语句),标准 I/O "
240+ "文件也不会刷新。"
0 commit comments