Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 9679:877d23bd5bdc legacy-trunk
Thanks to Chris Herborth, the thread primitives now have proper Py*
names in the source code (they already had those for the linker,
through some smart macros; but the source still had the old, un-Py names).
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 21 Dec 1998 19:32:43 +0000 |
| parents | 87b9554c51d4 |
| children | 8b61e1273b4b |
line wrap: on
line diff
--- a/Python/import.c Mon Dec 21 19:28:37 1998 +0000 +++ b/Python/import.c Mon Dec 21 19:32:43 1998 +0000 @@ -121,25 +121,25 @@ #include "pythread.h" -static type_lock import_lock = 0; +static PyThread_type_lock import_lock = 0; static long import_lock_thread = -1; static int import_lock_level = 0; static void lock_import() { - long me = get_thread_ident(); + long me = PyThread_get_thread_ident(); if (me == -1) return; /* Too bad */ if (import_lock == NULL) - import_lock = allocate_lock(); + import_lock = PyThread_allocate_lock(); if (import_lock_thread == me) { import_lock_level++; return; } - if (import_lock_thread != -1 || !acquire_lock(import_lock, 0)) { + if (import_lock_thread != -1 || !PyThread_acquire_lock(import_lock, 0)) { PyThreadState *tstate = PyEval_SaveThread(); - acquire_lock(import_lock, 1); + PyThread_acquire_lock(import_lock, 1); PyEval_RestoreThread(tstate); } import_lock_thread = me; @@ -149,7 +149,7 @@ static void unlock_import() { - long me = get_thread_ident(); + long me = PyThread_get_thread_ident(); if (me == -1) return; /* Too bad */ if (import_lock_thread != me) @@ -157,7 +157,7 @@ import_lock_level--; if (import_lock_level == 0) { import_lock_thread = -1; - release_lock(import_lock); + PyThread_release_lock(import_lock); } }
