@@ -1020,13 +1020,18 @@ msgid ""
1020
1020
" are done, you should reset the thread state pointer, release the GIL, and "
1021
1021
"finally free the thread state data structure."
1022
1022
msgstr ""
1023
+ "如果你需要从这些线程调用 Python 代码(这通常会是上述第三方库所提供的回调 API "
1024
+ "的一部分),你必须首先通过创建线程状态数据结构体向解释器注册这些线程,然后获取 GIL,最后存储它们的线程状态指针,这样你才能开始使用 Python/C"
1025
+ " API。 完成以上步骤后,你应当重置线程状态指针,释放 GIL,最后释放线程状态数据结构体。"
1023
1026
1024
1027
#: ../../c-api/init.rst:752
1025
1028
msgid ""
1026
1029
"The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions "
1027
1030
"do all of the above automatically. The typical idiom for calling into "
1028
1031
"Python from a C thread is::"
1029
1032
msgstr ""
1033
+ ":c:func:`PyGILState_Ensure` 和 :c:func:`PyGILState_Release` 函数会自动完成上述的所有操作。 从"
1034
+ " C 线程调用到 Python 的典型方式如下::"
1030
1035
1031
1036
#: ../../c-api/init.rst:766
1032
1037
msgid ""
@@ -1039,7 +1044,7 @@ msgstr ""
1039
1044
1040
1045
#: ../../c-api/init.rst:776
1041
1046
msgid "Cautions about fork()"
1042
- msgstr ""
1047
+ msgstr "有关 fork() 的注意事项 "
1043
1048
1044
1049
#: ../../c-api/init.rst:778
1045
1050
msgid ""
@@ -1049,6 +1054,9 @@ msgid ""
1049
1054
"concrete impact both on how locks must be handled and on all stored state in"
1050
1055
" CPython's runtime."
1051
1056
msgstr ""
1057
+ "有关线程的另一个需要注意的重要问题是它们在面对 C :c:func:`fork` 调用时的行为。 在大多数支持 :c:func:`fork` "
1058
+ "的系统中,当一个进程执行 fork 之后将只有发出 fork 的线程存在。 这对需要如何处理锁以及CPython "
1059
+ "的运行时内所有的存储状态都会有实质性的影响。"
1052
1060
1053
1061
#: ../../c-api/init.rst:784
1054
1062
msgid ""
0 commit comments