Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5758)

Side by Side Diff: Modules/_threadmodule.c

Issue 10915: Make the PyGILState API compatible with multiple interpreters
Patch Set: Created 8 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Modules/_ctypes/ctypes.h ('k') | Python/pystate.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* Thread module */ 2 /* Thread module */
3 /* Interface to Sjoerd's portable C thread library */ 3 /* Interface to Sjoerd's portable C thread library */
4 4
5 #include "Python.h" 5 #include "Python.h"
6 #include "structmember.h" /* offsetof */ 6 #include "structmember.h" /* offsetof */
7 7
8 #ifndef WITH_THREAD 8 #ifndef WITH_THREAD
9 #error "Error! The rest of Python is not compiled with thread support." 9 #error "Error! The rest of Python is not compiled with thread support."
10 #error "Rerun configure, adding a --with-threads option." 10 #error "Rerun configure, adding a --with-threads option."
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 977
978 static void 978 static void
979 t_bootstrap(void *boot_raw) 979 t_bootstrap(void *boot_raw)
980 { 980 {
981 struct bootstate *boot = (struct bootstate *) boot_raw; 981 struct bootstate *boot = (struct bootstate *) boot_raw;
982 PyThreadState *tstate; 982 PyThreadState *tstate;
983 PyObject *res; 983 PyObject *res;
984 984
985 tstate = boot->tstate; 985 tstate = boot->tstate;
986 tstate->thread_id = PyThread_get_thread_ident(); 986 tstate->thread_id = PyThread_get_thread_ident();
987 _PyThreadState_Init(tstate); 987 _PyThreadState_Init(boot->interp, tstate);
988 PyEval_AcquireThread(tstate); 988 PyEval_AcquireThread(tstate);
989 nb_threads++; 989 nb_threads++;
990 res = PyEval_CallObjectWithKeywords( 990 res = PyEval_CallObjectWithKeywords(
991 boot->func, boot->args, boot->keyw); 991 boot->func, boot->args, boot->keyw);
992 if (res == NULL) { 992 if (res == NULL) {
993 if (PyErr_ExceptionMatches(PyExc_SystemExit)) 993 if (PyErr_ExceptionMatches(PyExc_SystemExit))
994 PyErr_Clear(); 994 PyErr_Clear();
995 else { 995 else {
996 PyObject *file; 996 PyObject *file;
997 PySys_WriteStderr( 997 PySys_WriteStderr(
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 nb_threads = 0; 1324 nb_threads = 0;
1325 1325
1326 str_dict = PyUnicode_InternFromString("__dict__"); 1326 str_dict = PyUnicode_InternFromString("__dict__");
1327 if (str_dict == NULL) 1327 if (str_dict == NULL)
1328 return NULL; 1328 return NULL;
1329 1329
1330 /* Initialize the C thread library */ 1330 /* Initialize the C thread library */
1331 PyThread_init_thread(); 1331 PyThread_init_thread();
1332 return m; 1332 return m;
1333 } 1333 }
OLDNEW
« no previous file with comments | « Modules/_ctypes/ctypes.h ('k') | Python/pystate.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+