@@ -259,7 +259,7 @@ msgstr ":mod:`multiprocessing` 支持进程之间的两种通信通道:"
259259
260260#: ../../library/multiprocessing.rst:203
261261msgid "**Queues**"
262- msgstr "**Queues **"
262+ msgstr "**队列 **"
263263
264264#: ../../library/multiprocessing.rst:205
265265msgid ""
@@ -273,7 +273,7 @@ msgstr "队列是线程和进程安全的。"
273273
274274#: ../../library/multiprocessing.rst:222
275275msgid "**Pipes**"
276- msgstr "**Pipes **"
276+ msgstr "**管道 **"
277277
278278#: ../../library/multiprocessing.rst:224
279279msgid ""
@@ -297,51 +297,53 @@ msgstr ""
297297
298298#: ../../library/multiprocessing.rst:250
299299msgid "Synchronization between processes"
300- msgstr ""
300+ msgstr "进程之间的同步 "
301301
302302#: ../../library/multiprocessing.rst:252
303303msgid ""
304304":mod:`multiprocessing` contains equivalents of all the synchronization "
305305"primitives from :mod:`threading`. For instance one can use a lock to ensure"
306306" that only one process prints to standard output at a time::"
307307msgstr ""
308+ ":mod:`multiprocessing` 包含来自 :mod:`threading` "
309+ "的所有同步基本体的等价物。例如,可以使用锁来确保一次只有一个进程打印到标准输出::"
308310
309311#: ../../library/multiprocessing.rst:271
310312msgid ""
311313"Without using the lock output from the different processes is liable to get "
312314"all mixed up."
313- msgstr ""
315+ msgstr "不使用来自不同进程的锁输出容易产生混淆。 "
314316
315317#: ../../library/multiprocessing.rst:276
316318msgid "Sharing state between processes"
317- msgstr ""
319+ msgstr "在进程之间共享状态 "
318320
319321#: ../../library/multiprocessing.rst:278
320322msgid ""
321323"As mentioned above, when doing concurrent programming it is usually best to "
322324"avoid using shared state as far as possible. This is particularly true when"
323325" using multiple processes."
324- msgstr ""
326+ msgstr "如上所述,在进行并发编程时,通常最好尽量避免使用共享状态。使用多个进程时尤其如此。 "
325327
326328#: ../../library/multiprocessing.rst:282
327329msgid ""
328330"However, if you really do need to use some shared data then "
329331":mod:`multiprocessing` provides a couple of ways of doing so."
330- msgstr ""
332+ msgstr "但是,如果你真的需要使用一些共享数据,那么 :mod:`multiprocessing` 提供了两种方法。 "
331333
332334#: ../../library/multiprocessing.rst:285
333335msgid "**Shared memory**"
334- msgstr ""
336+ msgstr "**共享内存** "
335337
336338#: ../../library/multiprocessing.rst:287
337339msgid ""
338340"Data can be stored in a shared memory map using :class:`Value` or "
339341":class:`Array`. For example, the following code ::"
340- msgstr ""
342+ msgstr "可以使用 :class:`Value` 或 :class:`Array` 将数据存储在共享内存映射中。例如,以下代码:: "
341343
342344#: ../../library/multiprocessing.rst:308 ../../library/multiprocessing.rst:354
343345msgid "will print ::"
344- msgstr ""
346+ msgstr "将打印 :: "
345347
346348#: ../../library/multiprocessing.rst:313
347349msgid ""
@@ -350,24 +352,28 @@ msgid ""
350352"double precision float and ``'i'`` indicates a signed integer. These shared"
351353" objects will be process and thread-safe."
352354msgstr ""
355+ "创建 ``num`` 和 ``arr`` 时使用的 ``'d'`` 和 ``'i'`` 参数是 :mod:`array` 模块使用的类型的 "
356+ "typecode : ``'d'`` 表示双精度浮点数, ``'i'`` 表示有符号整数。这些共享对象将是进程和线程安全的。"
353357
354358#: ../../library/multiprocessing.rst:318
355359msgid ""
356360"For more flexibility in using shared memory one can use the "
357361":mod:`multiprocessing.sharedctypes` module which supports the creation of "
358362"arbitrary ctypes objects allocated from shared memory."
359363msgstr ""
364+ "为了更灵活地使用共享内存,可以使用 :mod:`multiprocessing.sharedctypes` "
365+ "模块,该模块支持创建从共享内存分配的任意ctypes对象。"
360366
361367#: ../../library/multiprocessing.rst:322
362368msgid "**Server process**"
363- msgstr ""
369+ msgstr "**服务器进程** "
364370
365371#: ../../library/multiprocessing.rst:324
366372msgid ""
367373"A manager object returned by :func:`Manager` controls a server process which"
368374" holds Python objects and allows other processes to manipulate them using "
369375"proxies."
370- msgstr ""
376+ msgstr "由 :func:`Manager` 返回的管理器对象控制一个服务器进程,该进程保存Python对象并允许其他进程使用代理操作它们。 "
371377
372378#: ../../library/multiprocessing.rst:328
373379msgid ""
@@ -377,6 +383,11 @@ msgid ""
377383":class:`Event`, :class:`Barrier`, :class:`Queue`, :class:`Value` and "
378384":class:`Array`. For example, ::"
379385msgstr ""
386+ ":func:`Manager` 返回的管理器支持类型: :class:`list` 、 :class:`dict` 、 "
387+ ":class:`~managers.Namespace` 、 :class:`Lock` 、 :class:`RLock` 、 "
388+ ":class:`Semaphore` 、 :class:`BoundedSemaphore` 、 :class:`Condition` 、 "
389+ ":class:`Event` 、 :class:`Barrier` 、 :class:`Queue` 、 :class:`Value` 和 "
390+ ":class:`Array` 。例如 ::"
380391
381392#: ../../library/multiprocessing.rst:359
382393msgid ""
@@ -385,17 +396,19 @@ msgid ""
385396"manager can be shared by processes on different computers over a network. "
386397"They are, however, slower than using shared memory."
387398msgstr ""
399+ "服务器进程管理器比使用共享内存对象更灵活,因为它们可以支持任意对象类型。此外,单个管理器可以通过网络由不同计算机上的进程共享。但是,它们比使用共享内存慢。"
388400
389401#: ../../library/multiprocessing.rst:366
390402msgid "Using a pool of workers"
391- msgstr ""
403+ msgstr "使用工作进程 "
392404
393405#: ../../library/multiprocessing.rst:368
394406msgid ""
395407"The :class:`~multiprocessing.pool.Pool` class represents a pool of worker "
396408"processes. It has methods which allows tasks to be offloaded to the worker "
397409"processes in a few different ways."
398410msgstr ""
411+ ":class:`~multiprocessing.pool.Pool` 类表示一个工作进程池。它具有允许以几种不同方式将任务分配到工作进程的方法。"
399412
400413#: ../../library/multiprocessing.rst:372
401414msgid "For example::"
@@ -405,7 +418,7 @@ msgstr "例如::"
405418msgid ""
406419"Note that the methods of a pool should only ever be used by the process "
407420"which created it."
408- msgstr ""
421+ msgstr "请注意,池的方法只能由创建它的进程使用。 "
409422
410423#: ../../library/multiprocessing.rst:421
411424msgid ""
@@ -415,34 +428,36 @@ msgid ""
415428"examples, such as the :class:`multiprocessing.pool.Pool` examples will not "
416429"work in the interactive interpreter. For example::"
417430msgstr ""
431+ "该软件包中的功能要求子项可以导入 ``__main__`` 模块。这包含在 :ref:`multiprocessing-programming` "
432+ "中,但值得指出。这意味着一些示例,例如 :class:`multiprocessing.pool.Pool` 示例在交互式解释器中不起作用。例如::"
418433
419434#: ../../library/multiprocessing.rst:443
420435msgid ""
421436"(If you try this it will actually output three full tracebacks interleaved "
422437"in a semi-random fashion, and then you may have to stop the master process "
423438"somehow.)"
424- msgstr ""
439+ msgstr "(如果你尝试这个,它实际上会以半随机的方式输出三个完整的回溯,然后你可能不得不以某种方式停止主进程。) "
425440
426441#: ../../library/multiprocessing.rst:449
427442msgid "Reference"
428- msgstr "参考引用 "
443+ msgstr "参考 "
429444
430445#: ../../library/multiprocessing.rst:451
431446msgid ""
432447"The :mod:`multiprocessing` package mostly replicates the API of the "
433448":mod:`threading` module."
434- msgstr ""
449+ msgstr ":mod:`multiprocessing` 包大部分复制了 :mod:`threading` 模块的API。 "
435450
436451#: ../../library/multiprocessing.rst:456
437452msgid ":class:`Process` and exceptions"
438- msgstr ""
453+ msgstr ":class:`Process` 和异常 "
439454
440455#: ../../library/multiprocessing.rst:461
441456msgid ""
442457"Process objects represent activity that is run in a separate process. The "
443458":class:`Process` class has equivalents of all the methods of "
444459":class:`threading.Thread`."
445- msgstr ""
460+ msgstr "进程对象表示在单独进程中运行的活动。 :class:`Process` 类等价于 :class:`threading.Thread` 。 "
446461
447462#: ../../library/multiprocessing.rst:465
448463msgid ""
0 commit comments