@@ -107,55 +107,55 @@ msgstr "*loop* 形参。"
107107
108108#: ../../library/asyncio-sync.rst:71
109109msgid "Acquire the lock."
110- msgstr ""
110+ msgstr "获取锁。 "
111111
112112#: ../../library/asyncio-sync.rst:73
113113msgid ""
114114"This method waits until the lock is *unlocked*, sets it to *locked* and "
115115"returns ``True``."
116- msgstr ""
116+ msgstr "此方法会等待直至锁为 *unlocked*,将其设为 *locked* 并返回 ``True``。 "
117117
118118#: ../../library/asyncio-sync.rst:76
119119msgid ""
120120"When more than one coroutine is blocked in :meth:`acquire` waiting for the "
121121"lock to be unlocked, only one coroutine eventually proceeds."
122- msgstr ""
122+ msgstr "当有一个以上的协程在 :meth:`acquire` 中被阻塞则会等待解锁,最终只有一个协程会被执行。 "
123123
124124#: ../../library/asyncio-sync.rst:80
125125msgid ""
126126"Acquiring a lock is *fair*: the coroutine that proceeds will be the first "
127127"coroutine that started waiting on the lock."
128- msgstr ""
128+ msgstr "锁的获取是 *公平的*: 被执行的协程将是第一个开始等待锁的协程。 "
129129
130130#: ../../library/asyncio-sync.rst:85
131131msgid "Release the lock."
132- msgstr ""
132+ msgstr "释放锁。 "
133133
134134#: ../../library/asyncio-sync.rst:87
135135msgid "When the lock is *locked*, reset it to *unlocked* and return."
136- msgstr ""
136+ msgstr "当锁为 *locked* 时,将其设为 *unlocked* 并返回。 "
137137
138138#: ../../library/asyncio-sync.rst:89
139139msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised."
140- msgstr ""
140+ msgstr "如果锁为 *unlocked*,则会引发 :exc:`RuntimeError`。 "
141141
142142#: ../../library/asyncio-sync.rst:93
143143msgid "Return ``True`` if the lock is *locked*."
144- msgstr ""
144+ msgstr "如果锁为 *locked* 则返回 ``True``。 "
145145
146146#: ../../library/asyncio-sync.rst:97
147147msgid "Event"
148- msgstr ""
148+ msgstr "Event "
149149
150150#: ../../library/asyncio-sync.rst:101
151151msgid "An event object. Not thread-safe."
152- msgstr ""
152+ msgstr "事件对象。 该对象不是线程安全的。 "
153153
154154#: ../../library/asyncio-sync.rst:103
155155msgid ""
156156"An asyncio event can be used to notify multiple asyncio tasks that some "
157157"event has happened."
158- msgstr ""
158+ msgstr "asyncio 事件可被用来通知多个 asyncio 任务已经有事件发生。 "
159159
160160#: ../../library/asyncio-sync.rst:106
161161msgid ""
@@ -164,56 +164,58 @@ msgid ""
164164":meth:`wait` method blocks until the flag is set to *true*. The flag is set"
165165" to *false* initially."
166166msgstr ""
167+ "Event 对象会管理一个内部旗标,可通过 :meth:`set` 方法将其设为 *true* 并通过 :meth:`clear` 方法将其设为 "
168+ "*false*。 :meth:`wait` 方法会阻塞直至该旗标被设为 *true*。 该旗标初始时将被设为 *false*。"
167169
168170#: ../../library/asyncio-sync.rst:117
169171msgid "Example::"
170172msgstr "示例::"
171173
172174#: ../../library/asyncio-sync.rst:142
173175msgid "Wait until the event is set."
174- msgstr ""
176+ msgstr "等待直至事件被设置。 "
175177
176178#: ../../library/asyncio-sync.rst:144
177179msgid ""
178180"If the event is set, return ``True`` immediately. Otherwise block until "
179181"another task calls :meth:`set`."
180- msgstr ""
182+ msgstr "如果事件已被设置,则立即返回 ``True``。 否则将阻塞直至另一个事件调用 :meth:`set`。 "
181183
182184#: ../../library/asyncio-sync.rst:149
183185msgid "Set the event."
184- msgstr ""
186+ msgstr "设置事件。 "
185187
186188#: ../../library/asyncio-sync.rst:151
187189msgid "All tasks waiting for event to be set will be immediately awakened."
188- msgstr ""
190+ msgstr "所有等待事件被设置的任务将被立即唤醒。 "
189191
190192#: ../../library/asyncio-sync.rst:156
191193msgid "Clear (unset) the event."
192- msgstr ""
194+ msgstr "清空(取消设置)事件. "
193195
194196#: ../../library/asyncio-sync.rst:158
195197msgid ""
196198"Tasks awaiting on :meth:`wait` will now block until the :meth:`set` method "
197199"is called again."
198- msgstr ""
200+ msgstr "通过 :meth:`wait` 进行等待的任务现在将会阻塞直至 :meth:`set` 方法再次被调用。 "
199201
200202#: ../../library/asyncio-sync.rst:163
201203msgid "Return ``True`` if the event is set."
202- msgstr ""
204+ msgstr "如果事件已被设置则返回 ``True``。 "
203205
204206#: ../../library/asyncio-sync.rst:167
205207msgid "Condition"
206- msgstr ""
208+ msgstr "Condition "
207209
208210#: ../../library/asyncio-sync.rst:171
209211msgid "A Condition object. Not thread-safe."
210- msgstr ""
212+ msgstr "条件对象。 该对象不是线程安全的。 "
211213
212214#: ../../library/asyncio-sync.rst:173
213215msgid ""
214216"An asyncio condition primitive can be used by a task to wait for some event "
215217"to happen and then get exclusive access to a shared resource."
216- msgstr ""
218+ msgstr "asyncio 条件原语可被任务用于等待某个事件发生,然后获取对共享资源的独占访问。 "
217219
218220#: ../../library/asyncio-sync.rst:177
219221msgid ""
@@ -223,33 +225,36 @@ msgid ""
223225" to a shared resource between different tasks interested in particular "
224226"states of that shared resource."
225227msgstr ""
228+ "在本质上,Condition 对象合并了 :class:`Event` 和 :class:`Lock` 的功能。 多个 Condition "
229+ "对象有可能共享一个 Lock,这允许关注于共享资源的特定状态的不同任务实现对共享资源的协同独占访问。"
226230
227231#: ../../library/asyncio-sync.rst:183
228232msgid ""
229233"The optional *lock* argument must be a :class:`Lock` object or ``None``. In"
230234" the latter case a new Lock object is created automatically."
231235msgstr ""
236+ "可选的 *lock* 参数必须为 :class:`Lock` 对象或 ``None``。 在后一种情况下会自动创建一个新的 Lock 对象。"
232237
233238#: ../../library/asyncio-sync.rst:191
234239msgid ""
235240"The preferred way to use a Condition is an :keyword:`async with` statement::"
236- msgstr ""
241+ msgstr "使用 Condition 的推荐方式是通过 :keyword:`async with` 语句:: "
237242
238243#: ../../library/asyncio-sync.rst:213
239244msgid "Acquire the underlying lock."
240- msgstr ""
245+ msgstr "获取下层的锁。 "
241246
242247#: ../../library/asyncio-sync.rst:215
243248msgid ""
244249"This method waits until the underlying lock is *unlocked*, sets it to "
245250"*locked* and returns ``True``."
246- msgstr ""
251+ msgstr "此方法会等待直至下层的锁为 *unlocked*,将其设为 *locked* 并返回 returns ``True``。 "
247252
248253#: ../../library/asyncio-sync.rst:220
249254msgid ""
250255"Wake up at most *n* tasks (1 by default) waiting on this condition. The "
251256"method is no-op if no tasks are waiting."
252- msgstr ""
257+ msgstr "唤醒最多 *n* 个正在等待此条件的任务(默认为 1 个)。 如果没有任务正在等待则此方法为空操作。 "
253258
254259#: ../../library/asyncio-sync.rst:223 ../../library/asyncio-sync.rst:238
255260msgid ""
0 commit comments