@@ -72,6 +72,7 @@ msgid ""
7272"different process can attach to that same shared memory block using that "
7373"same name."
7474msgstr ""
75+ "创建一个新的共享内存块或者连接到一片已经存在的共享内存块。每个共享内存块都被指定了一个全局唯一的名称。通过这种方式,一个进程可以通过提供一个特定的名字创建一个共享内存区块,然后其他进程使用同样的名字连接到这个共享内存块。"
7576
7677#: ../../library/multiprocessing.shared_memory.rst:47
7778msgid ""
@@ -82,19 +83,22 @@ msgid ""
8283" block is no longer needed by any process, the :meth:`unlink()` method "
8384"should be called to ensure proper cleanup."
8485msgstr ""
86+ "作为一种跨进成共享数据的方式,共享内存块的寿命可能超过创建它的原始进程。一个共享内存块可能同时被多个进程使用,当一个进程不再需要访问这个共享内存块的时候,应该调用"
87+ " :meth:`close()` 方法。当一个共享内存块不被任何进程使用的时候,应该调用 :meth:`unlink()` 方法以执行必要的清理。"
8588
8689#: ../../library/multiprocessing.shared_memory.rst:54
8790msgid ""
8891"*name* is the unique name for the requested shared memory, specified as a "
8992"string. When creating a new shared memory block, if ``None`` (the default) "
9093"is supplied for the name, a novel name will be generated."
9194msgstr ""
95+ "*name* 是共享内存的唯一名称,字符串类型。如果创建一个新共享内存块的时候,名称指定为 ``None`` (默认值),将会随机产生一个新名称。"
9296
9397#: ../../library/multiprocessing.shared_memory.rst:58
9498msgid ""
9599"*create* controls whether a new shared memory block is created (``True``) or"
96100" an existing shared memory block is attached (``False``)."
97- msgstr ""
101+ msgstr "*create* 指定创建一个新的共享内存块 (``True``) 还是连接到已存在的共享内存块 (``False``) 。 "
98102
99103#: ../../library/multiprocessing.shared_memory.rst:61
100104msgid ""
@@ -104,6 +108,9 @@ msgid ""
104108"memory block may be larger or equal to the size requested. When attaching "
105109"to an existing shared memory block, the ``size`` parameter is ignored."
106110msgstr ""
111+ "如果是新创建共享内存块则 *size* "
112+ "用于指定块的大小为多少字节。由于某些平台是使用特定内存页大小为最小单位来分配的,最终得到的内存块大小可能大于或等于要求的大小。如果是连接到已经存在的共享内存块,"
113+ " ``size`` 参数会被忽略。"
107114
108115#: ../../library/multiprocessing.shared_memory.rst:69
109116msgid ""
@@ -112,6 +119,8 @@ msgid ""
112119"instance is no longer needed. Note that calling ``close()`` does not cause "
113120"the shared memory block itself to be destroyed."
114121msgstr ""
122+ "关闭实例对于共享内存的访问连接。所有实例确认自己不再需要使用共享内存的时候都应该调用 ``close()`` ,以保证必要的资源清理。调用 "
123+ "``close()`` 并不会销毁共享内存区域。"
115124
116125#: ../../library/multiprocessing.shared_memory.rst:77
117126msgid ""
@@ -125,37 +134,43 @@ msgid ""
125134"relinquishing its hold on a shared memory block may call ``unlink()`` and "
126135":meth:`close()` in either order."
127136msgstr ""
137+ "请求销毁底层的共享内存块。为了执行必要的资源清理, 在所有使用这个共享内存块的进程中, ``unlink()`` 应该调用一次(且只能调用一次) "
138+ "。发出此销毁请求后,共享内存块可能会、也可能不会立即销毁,且此行为在不同操作系统之间可能不同。调用 ``unlink()`` "
139+ "后再尝试方位其中的数据可能导致内存错误。注意: 最后一个关闭共享内存访问权限的进程可以以任意顺序调用 ``unlink()`` 和 "
140+ ":meth:`close()` 。"
128141
129142#: ../../library/multiprocessing.shared_memory.rst:90
130143msgid "A memoryview of contents of the shared memory block."
131- msgstr ""
144+ msgstr "共享内存块内容的 memoryview 。 "
132145
133146#: ../../library/multiprocessing.shared_memory.rst:94
134147msgid "Read-only access to the unique name of the shared memory block."
135- msgstr ""
148+ msgstr "共享内存块的唯一标识,只读属性。 "
136149
137150#: ../../library/multiprocessing.shared_memory.rst:98
138151msgid "Read-only access to size in bytes of the shared memory block."
139- msgstr ""
152+ msgstr "共享内存块的字节大小,只读属性 "
140153
141154#: ../../library/multiprocessing.shared_memory.rst:101
142155msgid ""
143156"The following example demonstrates low-level use of :class:`SharedMemory` "
144157"instances::"
145- msgstr ""
158+ msgstr "以下示例展示了 :class:`SharedMemory` 的底层的用法:: "
146159
147160#: ../../library/multiprocessing.shared_memory.rst:127
148161msgid ""
149162"The following example demonstrates a practical use of the "
150163":class:`SharedMemory` class with `NumPy arrays <https://www.numpy.org/>`_, "
151164"accessing the same ``numpy.ndarray`` from two distinct Python shells:"
152165msgstr ""
166+ "以下示例展示了一个现实中的例子,使用 :class:`SharedMemory` 类和`NumPy arrays "
167+ "<https://www.numpy.org/>`_ 结合, 从两个 Python shell 中访问同一个 ``numpy.ndarray`` :"
153168
154169#: ../../library/multiprocessing.shared_memory.rst:181
155170msgid ""
156171"A subclass of :class:`~multiprocessing.managers.BaseManager` which can be "
157172"used for the management of shared memory blocks across processes."
158- msgstr ""
173+ msgstr ":class:`~multiprocessing.managers.BaseManager` 的子类,可用于管理跨进程的共享内存块。 "
159174
160175#: ../../library/multiprocessing.shared_memory.rst:184
161176msgid ""
0 commit comments