@@ -1032,13 +1032,18 @@ msgid ""
10321032" are done, you should reset the thread state pointer, release the GIL, and "
10331033"finally free the thread state data structure."
10341034msgstr ""
1035+ "如果你需要从这些线程调用 Python 代码(这通常会是上述第三方库所提供的回调 API "
1036+ "的一部分),你必须首先通过创建线程状态数据结构体向解释器注册这些线程,然后获取 GIL,最后存储它们的线程状态指针,这样你才能开始使用 Python/C"
1037+ " API。 完成以上步骤后,你应当重置线程状态指针,释放 GIL,最后释放线程状态数据结构体。"
10351038
10361039#: ../../c-api/init.rst:752
10371040msgid ""
10381041"The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions "
10391042"do all of the above automatically. The typical idiom for calling into "
10401043"Python from a C thread is::"
10411044msgstr ""
1045+ ":c:func:`PyGILState_Ensure` 和 :c:func:`PyGILState_Release` 函数会自动完成上述的所有操作。 从"
1046+ " C 线程调用到 Python 的典型方式如下::"
10421047
10431048#: ../../c-api/init.rst:766
10441049msgid ""
@@ -1051,7 +1056,7 @@ msgstr ""
10511056
10521057#: ../../c-api/init.rst:776
10531058msgid "Cautions about fork()"
1054- msgstr ""
1059+ msgstr "有关 fork() 的注意事项 "
10551060
10561061#: ../../c-api/init.rst:778
10571062msgid ""
@@ -1061,6 +1066,9 @@ msgid ""
10611066"concrete impact both on how locks must be handled and on all stored state in"
10621067" CPython's runtime."
10631068msgstr ""
1069+ "有关线程的另一个需要注意的重要问题是它们在面对 C :c:func:`fork` 调用时的行为。 在大多数支持 :c:func:`fork` "
1070+ "的系统中,当一个进程执行 fork 之后将只有发出 fork 的线程存在。 这对需要如何处理锁以及CPython "
1071+ "的运行时内所有的存储状态都会有实质性的影响。"
10641072
10651073#: ../../c-api/init.rst:784
10661074msgid ""
0 commit comments