summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Include/pythread.h76
-rw-r--r--Modules/_tkinter.c22
-rw-r--r--Modules/bsddbmodule.c18
-rw-r--r--Modules/signalmodule.c10
-rw-r--r--Modules/socketmodule.c16
-rw-r--r--Modules/stdwinmodule.c10
-rw-r--r--Modules/threadmodule.c79
-rw-r--r--Python/ceval.c26
-rw-r--r--Python/import.c14
-rw-r--r--Python/importdl.c2
-rw-r--r--Python/thread.c8
-rw-r--r--Python/thread_beos.h68
-rw-r--r--Python/thread_cthread.h84
-rw-r--r--Python/thread_foobar.h84
-rw-r--r--Python/thread_lwp.h86
-rw-r--r--Python/thread_nt.h90
-rw-r--r--Python/thread_os2.h78
-rw-r--r--Python/thread_pthread.h86
-rw-r--r--Python/thread_sgi.h114
-rw-r--r--Python/thread_solaris.h84
20 files changed, 507 insertions, 548 deletions
diff --git a/Include/pythread.h b/Include/pythread.h
index 9a2842c80e..752ab6d967 100644
--- a/Include/pythread.h
+++ b/Include/pythread.h
@@ -1,7 +1,7 @@
#ifndef _THREAD_H_included
#define _THREAD_H_included
-#define NO_EXIT_PROG /* don't define exit_prog() */
+#define NO_EXIT_PROG /* don't define PyThread_exit_prog() */
/* (the result is no use of signals on SGI) */
#ifndef Py_PROTO
@@ -12,76 +12,42 @@
#endif
#endif
-typedef void *type_lock;
-typedef void *type_sema;
+typedef void *PyThread_type_lock;
+typedef void *PyThread_type_sema;
#ifdef __cplusplus
extern "C" {
#endif
-/* Macros defining new names for all these symbols */
-/* BeOS note: We have exit_thread(), and no legacy code to
- * support, so we won't allow exit_thread and _exit_thread
- * in here. Actually, I think these #defines should vanish;
- * aren't they cheesy in the face of the Great Renaming? [cjh]
- */
-#define init_thread PyThread_init_thread
-#define start_new_thread PyThread_start_new_thread
-#ifndef __BEOS__
-#define exit_thread PyThread_exit_thread
-#define _exit_thread PyThread__exit_thread
-#endif
-#define get_thread_ident PyThread_get_thread_ident
-#define allocate_lock PyThread_allocate_lock
-#define free_lock PyThread_free_lock
-#define acquire_lock PyThread_acquire_lock
-#define release_lock PyThread_release_lock
-#define allocate_sema PyThread_allocate_sema
-#define free_sema PyThread_free_sema
-#define down_sema PyThread_down_sema
-#define up_sema PyThread_up_sema
-#define exit_prog PyThread_exit_prog
-#define _exit_prog PyThread__exit_prog
-#define create_key PyThread_create_key
-#define delete_key PyThread_delete_key
-#define get_key_value PyThread_get_key_value
-#define set_key_value PyThread_set_key_value
-
-
-DL_IMPORT(void) init_thread Py_PROTO((void));
-DL_IMPORT(int) start_new_thread Py_PROTO((void (*)(void *), void *));
-#ifndef __BEOS__
-DL_IMPORT(void) exit_thread Py_PROTO((void));
-DL_IMPORT(void) _exit_thread Py_PROTO((void));
-#else
+DL_IMPORT(void) PyThread_init_thread Py_PROTO((void));
+DL_IMPORT(int) PyThread_start_new_thread Py_PROTO((void (*)(void *), void *));
DL_IMPORT(void) PyThread_exit_thread Py_PROTO((void));
-DL_IMPORT(void) PyThread__exit_thread Py_PROTO((void));
-#endif
-DL_IMPORT(long) get_thread_ident Py_PROTO((void));
+DL_IMPORT(void) PyThread__PyThread_exit_thread Py_PROTO((void));
+DL_IMPORT(long) PyThread_get_thread_ident Py_PROTO((void));
-DL_IMPORT(type_lock) allocate_lock Py_PROTO((void));
-DL_IMPORT(void) free_lock Py_PROTO((type_lock));
-DL_IMPORT(int) acquire_lock Py_PROTO((type_lock, int));
+DL_IMPORT(PyThread_type_lock) PyThread_allocate_lock Py_PROTO((void));
+DL_IMPORT(void) PyThread_free_lock Py_PROTO((PyThread_type_lock));
+DL_IMPORT(int) PyThread_acquire_lock Py_PROTO((PyThread_type_lock, int));
#define WAIT_LOCK 1
#define NOWAIT_LOCK 0
-DL_IMPORT(void) release_lock Py_PROTO((type_lock));
+DL_IMPORT(void) PyThread_release_lock Py_PROTO((PyThread_type_lock));
-DL_IMPORT(type_sema) allocate_sema Py_PROTO((int));
-DL_IMPORT(void) free_sema Py_PROTO((type_sema));
-DL_IMPORT(int) down_sema Py_PROTO((type_sema, int));
+DL_IMPORT(PyThread_type_sema) PyThread_allocate_sema Py_PROTO((int));
+DL_IMPORT(void) PyThread_free_sema Py_PROTO((PyThread_type_sema));
+DL_IMPORT(int) PyThread_down_sema Py_PROTO((PyThread_type_sema, int));
#define WAIT_SEMA 1
#define NOWAIT_SEMA 0
-DL_IMPORT(void) up_sema Py_PROTO((type_sema));
+DL_IMPORT(void) PyThread_up_sema Py_PROTO((PyThread_type_sema));
#ifndef NO_EXIT_PROG
-DL_IMPORT(void) exit_prog Py_PROTO((int));
-DL_IMPORT(void) _exit_prog Py_PROTO((int));
+DL_IMPORT(void) PyThread_exit_prog Py_PROTO((int));
+DL_IMPORT(void) PyThread__PyThread_exit_prog Py_PROTO((int));
#endif
-DL_IMPORT(int) create_key Py_PROTO((void));
-DL_IMPORT(void) delete_key Py_PROTO((int));
-DL_IMPORT(int) set_key_value Py_PROTO((int, void *));
-DL_IMPORT(void *) get_key_value Py_PROTO((int));
+DL_IMPORT(int) PyThread_create_key Py_PROTO((void));
+DL_IMPORT(void) PyThread_delete_key Py_PROTO((int));
+DL_IMPORT(int) PyThread_set_key_value Py_PROTO((int, void *));
+DL_IMPORT(void *) PyThread_get_key_value Py_PROTO((int));
#ifdef __cplusplus
}
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 9d68c69f03..46bf8da564 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -171,29 +171,29 @@ PERFORMANCE OF THIS SOFTWARE.
*/
-static type_lock tcl_lock = 0;
+static PyThread_type_lock tcl_lock = 0;
static PyThreadState *tcl_tstate = NULL;
#define ENTER_TCL \
{ PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
- acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
+ PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
#define LEAVE_TCL \
- tcl_tstate = NULL; release_lock(tcl_lock); Py_END_ALLOW_THREADS}
+ tcl_tstate = NULL; PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
#define ENTER_OVERLAP \
Py_END_ALLOW_THREADS
#define LEAVE_OVERLAP_TCL \
- tcl_tstate = NULL; release_lock(tcl_lock); }
+ tcl_tstate = NULL; PyThread_release_lock(tcl_lock); }
#define ENTER_PYTHON \
{ PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
- release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
+ PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
#define LEAVE_PYTHON \
{ PyThreadState *tstate = PyEval_SaveThread(); \
- acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
+ PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
#else
@@ -1679,11 +1679,11 @@ Tkapp_MainLoop(self, args)
#ifdef WITH_THREAD
Py_BEGIN_ALLOW_THREADS
- acquire_lock(tcl_lock, 1);
+ PyThread_acquire_lock(tcl_lock, 1);
tcl_tstate = tstate;
result = Tcl_DoOneEvent(TCL_DONT_WAIT);
tcl_tstate = NULL;
- release_lock(tcl_lock);
+ PyThread_release_lock(tcl_lock);
if (result == 0)
Sleep(20);
Py_END_ALLOW_THREADS
@@ -1921,13 +1921,13 @@ EventHook()
#endif
#if defined(WITH_THREAD) || defined(MS_WINDOWS)
Py_BEGIN_ALLOW_THREADS
- acquire_lock(tcl_lock, 1);
+ PyThread_acquire_lock(tcl_lock, 1);
tcl_tstate = event_tstate;
result = Tcl_DoOneEvent(TCL_DONT_WAIT);
tcl_tstate = NULL;
- release_lock(tcl_lock);
+ PyThread_release_lock(tcl_lock);
if (result == 0)
Sleep(20);
Py_END_ALLOW_THREADS
@@ -2014,7 +2014,7 @@ init_tkinter()
Tkapp_Type.ob_type = &PyType_Type;
#ifdef WITH_THREAD
- tcl_lock = allocate_lock();
+ tcl_lock = PyThread_allocate_lock();
#endif
m = Py_InitModule("_tkinter", moduleMethods);
diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c
index 1bb40e6fd7..ef20624281 100644
--- a/Modules/bsddbmodule.c
+++ b/Modules/bsddbmodule.c
@@ -57,7 +57,7 @@ typedef struct {
DB *di_bsddb;
int di_size; /* -1 means recompute */
#ifdef WITH_THREAD
- type_lock di_lock;
+ PyThread_type_lock di_lock;
#endif
} bsddbobject;
@@ -113,7 +113,7 @@ newdbhashobject(file, flags, mode,
dp->di_size = -1;
#ifdef WITH_THREAD
- dp->di_lock = allocate_lock();
+ dp->di_lock = PyThread_allocate_lock();
if (dp->di_lock == NULL) {
PyErr_SetString(BsddbError, "can't allocate lock");
Py_DECREF(dp);
@@ -169,7 +169,7 @@ newdbbtobject(file, flags, mode,
dp->di_size = -1;
#ifdef WITH_THREAD
- dp->di_lock = allocate_lock();
+ dp->di_lock = PyThread_allocate_lock();
if (dp->di_lock == NULL) {
PyErr_SetString(BsddbError, "can't allocate lock");
Py_DECREF(dp);
@@ -225,7 +225,7 @@ newdbrnobject(file, flags, mode,
dp->di_size = -1;
#ifdef WITH_THREAD
- dp->di_lock = allocate_lock();
+ dp->di_lock = PyThread_allocate_lock();
if (dp->di_lock == NULL) {
PyErr_SetString(BsddbError, "can't allocate lock");
Py_DECREF(dp);
@@ -242,9 +242,9 @@ bsddb_dealloc(dp)
{
#ifdef WITH_THREAD
if (dp->di_lock) {
- acquire_lock(dp->di_lock, 0);
- release_lock(dp->di_lock);
- free_lock(dp->di_lock);
+ PyThread_acquire_lock(dp->di_lock, 0);
+ PyThread_release_lock(dp->di_lock);
+ PyThread_free_lock(dp->di_lock);
dp->di_lock = NULL;
}
#endif
@@ -262,8 +262,8 @@ bsddb_dealloc(dp)
}
#ifdef WITH_THREAD
-#define BSDDB_BGN_SAVE(_dp) Py_BEGIN_ALLOW_THREADS acquire_lock(_dp->di_lock,1);
-#define BSDDB_END_SAVE(_dp) release_lock(_dp->di_lock); Py_END_ALLOW_THREADS
+#define BSDDB_BGN_SAVE(_dp) Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(_dp->di_lock,1);
+#define BSDDB_END_SAVE(_dp) PyThread_release_lock(_dp->di_lock); Py_END_ALLOW_THREADS
#else
#define BSDDB_BGN_SAVE(_dp) Py_BEGIN_ALLOW_THREADS
#define BSDDB_END_SAVE(_dp) Py_END_ALLOW_THREADS
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 11b624a704..26bb94050e 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -221,7 +221,7 @@ signal_signal(self, args)
if (!PyArg_Parse(args, "(iO)", &sig_num, &obj))
return NULL;
#ifdef WITH_THREAD
- if (get_thread_ident() != main_thread) {
+ if (PyThread_get_thread_ident() != main_thread) {
PyErr_SetString(PyExc_ValueError,
"signal only works in main thread");
return NULL;
@@ -346,7 +346,7 @@ initsignal()
int i;
#ifdef WITH_THREAD
- main_thread = get_thread_ident();
+ main_thread = PyThread_get_thread_ident();
main_pid = getpid();
#endif
@@ -619,7 +619,7 @@ PyErr_CheckSignals()
if (!is_tripped)
return 0;
#ifdef WITH_THREAD
- if (get_thread_ident() != main_thread)
+ if (PyThread_get_thread_ident() != main_thread)
return 0;
#endif
if (!(f = PyEval_GetFrame()))
@@ -676,7 +676,7 @@ PyOS_InterruptOccurred()
{
if (Handlers[SIGINT].tripped) {
#ifdef WITH_THREAD
- if (get_thread_ident() != main_thread)
+ if (PyThread_get_thread_ident() != main_thread)
return 0;
#endif
Handlers[SIGINT].tripped = 0;
@@ -689,7 +689,7 @@ void
PyOS_AfterFork()
{
#ifdef WITH_THREAD
- main_thread = get_thread_ident();
+ main_thread = PyThread_get_thread_ident();
main_pid = getpid();
#endif
}
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 0564e17f2f..ab0014c79c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -313,7 +313,7 @@ BUILD_FUNC_DEF_4(PySocketSock_New,int,fd, int,family, int,type, int,proto)
/* Lock to allow python interpreter to continue, but only allow one
thread to be in gethostbyname */
#if defined(WITH_THREAD) && !defined(HAVE_GETHOSTBYNAME_R) && !defined(MS_WINDOWS)
-type_lock gethostbyname_lock;
+PyThread_type_lock gethostbyname_lock;
#endif
@@ -358,11 +358,11 @@ BUILD_FUNC_DEF_2(setipaddr, char*,name, struct sockaddr_in *,addr_ret)
hp = gethostbyname_r(name, &hp_allocated, buf, buf_len, &errnop);
#else /* not HAVE_GETHOSTBYNAME_R */
#if defined(WITH_THREAD) && !defined(MS_WINDOWS)
- acquire_lock(gethostbyname_lock,1);
+ PyThread_acquire_lock(gethostbyname_lock,1);
#endif
hp = gethostbyname(name);
#if defined(WITH_THREAD) && !defined(MS_WINDOWS)
- release_lock(gethostbyname_lock);
+ PyThread_release_lock(gethostbyname_lock);
#endif
#endif /* HAVE_GETHOSTBYNAME_R */
Py_END_ALLOW_THREADS
@@ -1417,11 +1417,11 @@ BUILD_FUNC_DEF_2(PySocket_gethostbyname_ex,PyObject *,self, PyObject *,args)
h = gethostbyname_r(name, &hp_allocated, buf, buf_len, &errnop);
#else /* not HAVE_GETHOSTBYNAME_R */
#if defined(WITH_THREAD) && !defined(MS_WINDOWS)
- acquire_lock(gethostbyname_lock,1);
+ PyThread_acquire_lock(gethostbyname_lock,1);
#endif
h = gethostbyname(name);
#if defined(WITH_THREAD) && !defined(MS_WINDOWS)
- release_lock(gethostbyname_lock);
+ PyThread_release_lock(gethostbyname_lock);
#endif
#endif /* HAVE_GETHOSTBYNAME_R */
Py_END_ALLOW_THREADS
@@ -1463,13 +1463,13 @@ BUILD_FUNC_DEF_2(PySocket_gethostbyaddr,PyObject *,self, PyObject *, args)
&hp_allocated, buf, buf_len, &errnop);
#else /* not HAVE_GETHOSTBYNAME_R */
#if defined(WITH_THREAD) && !defined(MS_WINDOWS)
- acquire_lock(gethostbyname_lock,1);
+ PyThread_acquire_lock(gethostbyname_lock,1);
#endif
h = gethostbyaddr((char *)&addr.sin_addr,
sizeof(addr.sin_addr),
AF_INET);
#if defined(WITH_THREAD) && !defined(MS_WINDOWS)
- release_lock(gethostbyname_lock);
+ PyThread_release_lock(gethostbyname_lock);
#endif
#endif /* HAVE_GETHOSTBYNAME_R */
Py_END_ALLOW_THREADS
@@ -2188,6 +2188,6 @@ initsocket()
/* Initialize gethostbyname lock */
#if defined(WITH_THREAD) && !defined(HAVE_GETHOSTBYNAME_R) && !defined(MS_WINDOWS)
- gethostbyname_lock = allocate_lock();
+ gethostbyname_lock = PyThread_allocate_lock();
#endif
}
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c
index 8b18f4920c..ffae73096f 100644
--- a/Modules/stdwinmodule.c
+++ b/Modules/stdwinmodule.c
@@ -87,11 +87,11 @@ PERFORMANCE OF THIS SOFTWARE.
#include "pythread.h"
-static type_lock StdwinLock; /* Lock held when interpreter not locked */
+static PyThread_type_lock StdwinLock; /* Lock held when interpreter not locked */
-#define BGN_STDWIN Py_BEGIN_ALLOW_THREADS acquire_lock(StdwinLock, 1);
-#define RET_STDWIN release_lock(StdwinLock); Py_BLOCK_THREADS
-#define END_STDWIN release_lock(StdwinLock); Py_END_ALLOW_THREADS
+#define BGN_STDWIN Py_BEGIN_ALLOW_THREADS PyThread_acquire_lock(StdwinLock, 1);
+#define RET_STDWIN PyThread_release_lock(StdwinLock); Py_BLOCK_THREADS
+#define END_STDWIN PyThread_release_lock(StdwinLock); Py_END_ALLOW_THREADS
#else
@@ -2659,6 +2659,6 @@ initstdwin()
PyDict_SetItemString(d, "error", StdwinError) != 0)
return;
#ifdef WITH_THREAD
- StdwinLock = allocate_lock();
+ StdwinLock = PyThread_allocate_lock();
#endif
}
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index b08ff0bc1c..3d5e4ccb32 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -49,7 +49,7 @@ static PyObject *ThreadError;
typedef struct {
PyObject_HEAD
- type_lock lock_lock;
+ PyThread_type_lock lock_lock;
} lockobject;
staticforward PyTypeObject Locktype;
@@ -61,7 +61,7 @@ newlockobject()
self = PyObject_NEW(lockobject, &Locktype);
if (self == NULL)
return NULL;
- self->lock_lock = allocate_lock();
+ self->lock_lock = PyThread_allocate_lock();
if (self->lock_lock == NULL) {
PyMem_DEL(self);
self = NULL;
@@ -75,15 +75,15 @@ lock_dealloc(self)
lockobject *self;
{
/* Unlock the lock so it's safe to free it */
- acquire_lock(self->lock_lock, 0);
- release_lock(self->lock_lock);
+ PyThread_acquire_lock(self->lock_lock, 0);
+ PyThread_release_lock(self->lock_lock);
- free_lock(self->lock_lock);
+ PyThread_free_lock(self->lock_lock);
PyMem_DEL(self);
}
static PyObject *
-lock_acquire_lock(self, args)
+lock_PyThread_acquire_lock(self, args)
lockobject *self;
PyObject *args;
{
@@ -97,7 +97,7 @@ lock_acquire_lock(self, args)
i = 1;
Py_BEGIN_ALLOW_THREADS
- i = acquire_lock(self->lock_lock, i);
+ i = PyThread_acquire_lock(self->lock_lock, i);
Py_END_ALLOW_THREADS
if (args == NULL) {
@@ -110,7 +110,7 @@ lock_acquire_lock(self, args)
static char acquire_doc[] =
"acquire([wait]) -> None or Boolean\n\
-(acquire_lock() is an obsolete synonym)\n\
+(PyThread_acquire_lock() is an obsolete synonym)\n\
\n\
Lock the lock. Without argument, this blocks if the lock is already\n\
locked (even by the same thread), waiting for another thread to release\n\
@@ -120,7 +120,7 @@ and the return value reflects whether the lock is acquired.\n\
The blocking operation is not interruptible.";
static PyObject *
-lock_release_lock(self, args)
+lock_PyThread_release_lock(self, args)
lockobject *self;
PyObject *args;
{
@@ -128,20 +128,20 @@ lock_release_lock(self, args)
return NULL;
/* Sanity check: the lock must be locked */
- if (acquire_lock(self->lock_lock, 0)) {
- release_lock(self->lock_lock);
+ if (PyThread_acquire_lock(self->lock_lock, 0)) {
+ PyThread_release_lock(self->lock_lock);
PyErr_SetString(ThreadError, "release unlocked lock");
return NULL;
}
- release_lock(self->lock_lock);
+ PyThread_release_lock(self->lock_lock);
Py_INCREF(Py_None);
return Py_None;
}
static char release_doc[] =
"release()\n\
-(release_lock() is an obsolete synonym)\n\
+(PyThread_release_lock() is an obsolete synonym)\n\
\n\
Release the lock, allowing another thread that is blocked waiting for\n\
the lock to acquire the lock. The lock must be in the locked state,\n\
@@ -155,8 +155,8 @@ lock_locked_lock(self, args)
if (!PyArg_NoArgs(args))
return NULL;
- if (acquire_lock(self->lock_lock, 0)) {
- release_lock(self->lock_lock);
+ if (PyThread_acquire_lock(self->lock_lock, 0)) {
+ PyThread_release_lock(self->lock_lock);
return PyInt_FromLong(0L);
}
return PyInt_FromLong(1L);
@@ -169,10 +169,10 @@ static char locked_doc[] =
Return whether the lock is in the locked state.";
static PyMethodDef lock_methods[] = {
- {"acquire_lock", (PyCFunction)lock_acquire_lock, 0, acquire_doc},
- {"acquire", (PyCFunction)lock_acquire_lock, 0, acquire_doc},
- {"release_lock", (PyCFunction)lock_release_lock, 0, release_doc},
- {"release", (PyCFunction)lock_release_lock, 0, release_doc},
+ {"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, 0, acquire_doc},
+ {"acquire", (PyCFunction)lock_PyThread_acquire_lock, 0, acquire_doc},
+ {"release_lock", (PyCFunction)lock_PyThread_release_lock, 0, release_doc},
+ {"release", (PyCFunction)lock_PyThread_release_lock, 0, release_doc},
{"locked_lock", (PyCFunction)lock_locked_lock, 0, locked_doc},
{"locked", (PyCFunction)lock_locked_lock, 0, locked_doc},
{NULL, NULL} /* sentinel */
@@ -240,18 +240,11 @@ t_bootstrap(boot_raw)
PyThreadState_Clear(tstate);
PyEval_ReleaseThread(tstate);
PyThreadState_Delete(tstate);
-#ifdef __BEOS__
- /* Dunno if this will cause problems with other ports; the BeOS thread
- * support features only 100% renamed functions. [cjh]
- */
PyThread_exit_thread();
-#else
- exit_thread();
-#endif
}
static PyObject *
-thread_start_new_thread(self, fargs)
+thread_PyThread_start_new_thread(self, fargs)
PyObject *self; /* Not used */
PyObject *fargs;
{
@@ -286,7 +279,7 @@ thread_start_new_thread(self, fargs)
Py_INCREF(args);
Py_XINCREF(keyw);
PyEval_InitThreads(); /* Start the interpreter's thread-awareness */
- if (!start_new_thread(t_bootstrap, (void*) boot)) {
+ if (!PyThread_start_new_thread(t_bootstrap, (void*) boot)) {
PyErr_SetString(ThreadError, "can't start new thread\n");
Py_DECREF(func);
Py_DECREF(args);
@@ -310,7 +303,7 @@ unhandled exception; a stack trace will be printed unless the exception is\n\
SystemExit.";
static PyObject *
-thread_exit_thread(self, args)
+thread_PyThread_exit_thread(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
@@ -322,27 +315,27 @@ thread_exit_thread(self, args)
static char exit_doc[] =
"exit()\n\
-(exit_thread() is an obsolete synonym)\n\
+(PyThread_exit_thread() is an obsolete synonym)\n\
\n\
This is synonymous to ``raise SystemExit''. It will cause the current\n\
thread to exit silently unless the exception is caught.";
#ifndef NO_EXIT_PROG
static PyObject *
-thread_exit_prog(self, args)
+thread_PyThread_exit_prog(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int sts;
if (!PyArg_Parse(args, "i", &sts))
return NULL;
- Py_Exit(sts); /* Calls exit_prog(sts) or _exit_prog(sts) */
+ Py_Exit(sts); /* Calls PyThread_exit_prog(sts) or _PyThread_exit_prog(sts) */
for (;;) { } /* Should not be reached */
}
#endif
static PyObject *
-thread_allocate_lock(self, args)
+thread_PyThread_allocate_lock(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
@@ -365,7 +358,7 @@ thread_get_ident(self, args)
long ident;
if (!PyArg_NoArgs(args))
return NULL;
- ident = get_thread_ident();
+ ident = PyThread_get_thread_ident();
if (ident == -1) {
PyErr_SetString(ThreadError, "no current thread ident");
return NULL;
@@ -385,22 +378,22 @@ be relied upon, and the number should be seen purely as a magic cookie.\n\
A thread's identity may be reused for another thread after it exits.";
static PyMethodDef thread_methods[] = {
- {"start_new_thread", (PyCFunction)thread_start_new_thread, 1,
+ {"start_new_thread", (PyCFunction)thread_PyThread_start_new_thread, 1,
start_new_doc},
- {"start_new", (PyCFunction)thread_start_new_thread, 1,
+ {"start_new", (PyCFunction)thread_PyThread_start_new_thread, 1,
start_new_doc},
- {"allocate_lock", (PyCFunction)thread_allocate_lock, 0,
+ {"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, 0,
allocate_doc},
- {"allocate", (PyCFunction)thread_allocate_lock, 0,
+ {"allocate", (PyCFunction)thread_PyThread_allocate_lock, 0,
allocate_doc},
- {"exit_thread", (PyCFunction)thread_exit_thread, 0,
+ {"exit_thread", (PyCFunction)thread_PyThread_exit_thread, 0,
exit_doc},
- {"exit", (PyCFunction)thread_exit_thread, 0,
+ {"exit", (PyCFunction)thread_PyThread_exit_thread, 0,
exit_doc},
{"get_ident", (PyCFunction)thread_get_ident, 0,
get_ident_doc},
#ifndef NO_EXIT_PROG
- {"exit_prog", (PyCFunction)thread_exit_prog},
+ {"exit_prog", (PyCFunction)thread_PyThread_exit_prog},
#endif
{NULL, NULL} /* sentinel */
};
@@ -414,7 +407,7 @@ The 'threading' module provides a more convenient interface.";
static char lock_doc[] =
"A lock object is a synchronization primitive. To create a lock,\n\
-call the allocate_lock() function. Methods are:\n\
+call the PyThread_allocate_lock() function. Methods are:\n\
\n\
acquire() -- lock the lock, possibly blocking until it can be obtained\n\
release() -- unlock of the lock\n\
@@ -441,5 +434,5 @@ initthread()
PyDict_SetItemString(d, "LockType", (PyObject *)&Locktype);
/* Initialize the C thread library */
- init_thread();
+ PyThread_init_thread();
}
diff --git a/Python/ceval.c b/Python/ceval.c
index b013ca15b7..f52eb0e88a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -113,7 +113,7 @@ static long dxp[256];
extern int _PyThread_Started; /* Flag for Py_Exit */
-static type_lock interpreter_lock = 0;
+static PyThread_type_lock interpreter_lock = 0;
static long main_thread = 0;
void
@@ -122,21 +122,21 @@ PyEval_InitThreads()
if (interpreter_lock)
return;
_PyThread_Started = 1;
- interpreter_lock = allocate_lock();
- acquire_lock(interpreter_lock, 1);
- main_thread = get_thread_ident();
+ interpreter_lock = PyThread_allocate_lock();
+ PyThread_acquire_lock(interpreter_lock, 1);
+ main_thread = PyThread_get_thread_ident();
}
void
PyEval_AcquireLock()
{
- acquire_lock(interpreter_lock, 1);
+ PyThread_acquire_lock(interpreter_lock, 1);
}
void
PyEval_ReleaseLock()
{
- release_lock(interpreter_lock);
+ PyThread_release_lock(interpreter_lock);
}
void
@@ -145,7 +145,7 @@ PyEval_AcquireThread(tstate)
{
if (tstate == NULL)
Py_FatalError("PyEval_AcquireThread: NULL new thread state");
- acquire_lock(interpreter_lock, 1);
+ PyThread_acquire_lock(interpreter_lock, 1);
if (PyThreadState_Swap(tstate) != NULL)
Py_FatalError(
"PyEval_AcquireThread: non-NULL old thread state");
@@ -159,7 +159,7 @@ PyEval_ReleaseThread(tstate)
Py_FatalError("PyEval_ReleaseThread: NULL thread state");
if (PyThreadState_Swap(NULL) != tstate)
Py_FatalError("PyEval_ReleaseThread: wrong thread state");
- release_lock(interpreter_lock);
+ PyThread_release_lock(interpreter_lock);
}
#endif
@@ -175,7 +175,7 @@ PyEval_SaveThread()
Py_FatalError("PyEval_SaveThread: NULL tstate");
#ifdef WITH_THREAD
if (interpreter_lock)
- release_lock(interpreter_lock);
+ PyThread_release_lock(interpreter_lock);
#endif
return tstate;
}
@@ -189,7 +189,7 @@ PyEval_RestoreThread(tstate)
#ifdef WITH_THREAD
if (interpreter_lock) {
int err = errno;
- acquire_lock(interpreter_lock, 1);
+ PyThread_acquire_lock(interpreter_lock, 1);
errno = err;
}
#endif
@@ -269,7 +269,7 @@ Py_MakePendingCalls()
{
static int busy = 0;
#ifdef WITH_THREAD
- if (main_thread && get_thread_ident() != main_thread)
+ if (main_thread && PyThread_get_thread_ident() != main_thread)
return 0;
#endif
if (busy)
@@ -622,11 +622,11 @@ eval_code2(co, globals, locals,
if (PyThreadState_Swap(NULL) != tstate)
Py_FatalError("ceval: tstate mix-up");
- release_lock(interpreter_lock);
+ PyThread_release_lock(interpreter_lock);
/* Other threads may run now */
- acquire_lock(interpreter_lock, 1);
+ PyThread_acquire_lock(interpreter_lock, 1);
if (PyThreadState_Swap(tstate) != NULL)
Py_FatalError("ceval: orphan tstate");
}
diff --git a/Python/import.c b/Python/import.c
index 2707019414..d35a8b7eb5 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -121,25 +121,25 @@ _PyImport_Fini()
#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 @@ lock_import()
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 @@ unlock_import()
import_lock_level--;
if (import_lock_level == 0) {
import_lock_thread = -1;
- release_lock(import_lock);
+ PyThread_release_lock(import_lock);
}
}
diff --git a/Python/importdl.c b/Python/importdl.c
index dc97f67f18..dd0f1543b5 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -196,7 +196,7 @@ typedef void (*dl_funcptr)(void);
#ifdef WITH_THREAD
#include "pythread.h"
-static type_lock beos_dyn_lock;
+static PyThread_type_lock beos_dyn_lock;
#endif
static PyObject *beos_dyn_images = NULL;
diff --git a/Python/thread.c b/Python/thread.c
index 2c206908b4..c533398a3c 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -109,9 +109,9 @@ static int thread_debug = 0;
static int initialized;
-static void _init_thread(); /* Forward */
+static void PyThread__init_thread(); /* Forward */
-void init_thread _P0()
+void PyThread_init_thread _P0()
{
#ifdef Py_DEBUG
char *p = getenv("THREADDEBUG");
@@ -126,8 +126,8 @@ void init_thread _P0()
if (initialized)
return;
initialized = 1;
- dprintf(("init_thread called\n"));
- _init_thread();
+ dprintf(("PyThread_init_thread called\n"));
+ PyThread__init_thread();
}
#ifdef SGI_THREADS
diff --git a/Python/thread_beos.h b/Python/thread_beos.h
index f2024f31b9..0dff786436 100644
--- a/Python/thread_beos.h
+++ b/Python/thread_beos.h
@@ -129,7 +129,7 @@ static status_t benaphore_unlock( benaphore_t *ben )
/* ----------------------------------------------------------------------
* Initialization.
*/
-static void _init_thread( void )
+static void PyThread__init_thread( void )
{
/* Do nothing. */
return;
@@ -151,7 +151,7 @@ int PyThread_start_new_thread( void (*func)(void *), void *arg )
char name[B_OS_NAME_LENGTH];
int32 this_thread;
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
/* We are so very thread-safe... */
this_thread = atomic_add( &thread_count, 1 );
@@ -175,11 +175,11 @@ long PyThread_get_thread_ident( void )
return ( tid != B_NAME_NOT_FOUND ? tid : -1 );
}
-static void do_exit_thread( int no_cleanup )
+static void do_PyThread_exit_thread( int no_cleanup )
{
int32 threads;
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
/* Thread-safe way to read a variable without a mutex: */
threads = atomic_add( &thread_count, 0 );
@@ -199,18 +199,18 @@ static void do_exit_thread( int no_cleanup )
void PyThread_exit_thread( void )
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
void PyThread__exit_thread( void )
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog( int status, int no_cleanup )
+static void do_PyThread_exit_prog( int status, int no_cleanup )
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
/* No need to do anything, the threads get torn down if main() exits. */
@@ -223,12 +223,12 @@ static void do_exit_prog( int status, int no_cleanup )
void PyThread_exit_prog( int status )
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
void PyThread__exit_prog( int status )
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
@@ -238,19 +238,19 @@ void PyThread__exit_prog( int status )
static int32 lock_count = 0;
-type_lock PyThread_allocate_lock( void )
+PyThread_type_lock PyThread_allocate_lock( void )
{
benaphore_t *lock;
status_t retval;
char name[B_OS_NAME_LENGTH];
int32 this_lock;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
lock = (benaphore_t *)malloc( sizeof( benaphore_t ) );
if( lock == NULL ) {
/* TODO: that's bad, raise MemoryError */
- return (type_lock)NULL;
+ return (PyThread_type_lock)NULL;
}
this_lock = atomic_add( &lock_count, 1 );
@@ -259,18 +259,18 @@ type_lock PyThread_allocate_lock( void )
retval = benaphore_create( name, lock );
if( retval != EOK ) {
/* TODO: that's bad, raise an exception */
- return (type_lock)NULL;
+ return (PyThread_type_lock)NULL;
}
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void PyThread_free_lock( type_lock lock )
+void PyThread_free_lock( PyThread_type_lock lock )
{
status_t retval;
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
retval = benaphore_destroy( (benaphore_t *)lock );
if( retval != EOK ) {
@@ -279,12 +279,12 @@ void PyThread_free_lock( type_lock lock )
}
}
-int PyThread_acquire_lock( type_lock lock, int waitflag )
+int PyThread_acquire_lock( PyThread_type_lock lock, int waitflag )
{
int success;
status_t retval;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
if( waitflag ) {
retval = benaphore_lock( (benaphore_t *)lock );
@@ -300,15 +300,15 @@ int PyThread_acquire_lock( type_lock lock, int waitflag )
/* TODO: that's bad, raise an exception */
}
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void PyThread_release_lock( type_lock lock )
+void PyThread_release_lock( PyThread_type_lock lock )
{
status_t retval;
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
retval = benaphore_unlock( (benaphore_t *)lock );
if( retval != EOK ) {
@@ -324,11 +324,11 @@ void PyThread_release_lock( type_lock lock )
* I'll do it anyway, you never know when it might be handy, and it's
* easy...
*/
-type_sema PyThread_allocate_sema( int value )
+PyThread_type_sema PyThread_allocate_sema( int value )
{
sem_id sema;
- dprintf(("allocate_sema called\n"));
+ dprintf(("PyThread_allocate_sema called\n"));
sema = create_sem( value, "python semaphore" );
if( sema < B_NO_ERROR ) {
@@ -336,15 +336,15 @@ type_sema PyThread_allocate_sema( int value )
return 0;
}
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void PyThread_free_sema( type_sema sema )
+void PyThread_free_sema( PyThread_type_sema sema )
{
status_t retval;
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
retval = delete_sem( (sem_id)sema );
if( retval != B_NO_ERROR ) {
@@ -353,11 +353,11 @@ void PyThread_free_sema( type_sema sema )
}
}
-int PyThread_down_sema( type_sema sema, int waitflag )
+int PyThread_down_sema( PyThread_type_sema sema, int waitflag )
{
status_t retval;
- dprintf(("down_sema(%lx, %d) called\n", (long) sema, waitflag));
+ dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag));
if( waitflag ) {
retval = acquire_sem( (sem_id)sema );
@@ -370,15 +370,15 @@ int PyThread_down_sema( type_sema sema, int waitflag )
return 0;
}
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
return -1;
}
-void PyThread_up_sema( type_sema sema )
+void PyThread_up_sema( PyThread_type_sema sema )
{
status_t retval;
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
retval = release_sem( (sem_id)sema );
if( retval != B_NO_ERROR ) {
diff --git a/Python/thread_cthread.h b/Python/thread_cthread.h
index 3f48d592dd..11370c56ed 100644
--- a/Python/thread_cthread.h
+++ b/Python/thread_cthread.h
@@ -35,7 +35,7 @@ PERFORMANCE OF THIS SOFTWARE.
/*
* Initialization.
*/
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
cthread_init();
}
@@ -43,14 +43,14 @@ static void _init_thread _P0()
/*
* Thread support.
*/
-int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
+int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
int success = 0; /* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
/* looks like solaris detaches the thread to never rejoin
* so well do it here
*/
@@ -58,16 +58,16 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
-long get_thread_ident _P0()
+long PyThread_get_thread_ident _P0()
{
if (!initialized)
- init_thread();
+ PyThread_init_thread();
return (long) cthread_self();
}
-static void do_exit_thread _P1(no_cleanup, int no_cleanup)
+static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
{
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -76,20 +76,20 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
cthread_exit(0);
}
-void exit_thread _P0()
+void PyThread_exit_thread _P0()
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread _P0()
+void PyThread__exit_thread _P0()
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
+static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -101,27 +101,27 @@ static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
exit(status);
}
-void exit_prog _P1(status, int status)
+void PyThread_exit_prog _P1(status, int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(status, int status)
+void PyThread__exit_prog _P1(status, int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/*
* Lock support.
*/
-type_lock allocate_lock _P0()
+PyThread_type_lock PyThread_allocate_lock _P0()
{
mutex_t lock;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
lock = mutex_alloc();
if (mutex_init(lock)) {
@@ -129,34 +129,34 @@ type_lock allocate_lock _P0()
free((void *) lock);
lock = 0;
}
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void free_lock _P1(lock, type_lock lock)
+void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
mutex_free(lock);
}
-int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
+int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{
int success = FALSE;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
if (waitflag) { /* blocking */
mutex_lock(lock);
success = TRUE;
} else { /* non blocking */
success = mutex_try_lock(lock);
}
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void release_lock _P1(lock, type_lock lock)
+void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
mutex_unlock((mutex_t )lock);
}
@@ -174,30 +174,30 @@ void release_lock _P1(lock, type_lock lock)
* semaphore using a condition.
*
*/
-type_sema allocate_sema _P1(value, int value)
+PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
{
char *sema = 0;
- dprintf(("allocate_sema called\n"));
+ dprintf(("PyThread_allocate_sema called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void free_sema _P1(sema, type_sema sema)
+void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
}
-int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
+int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{
- dprintf(("down_sema(%lx, %d) called\n", (long) sema, waitflag));
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag));
+ dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
return -1;
}
-void up_sema _P1(sema, type_sema sema)
+void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
}
diff --git a/Python/thread_foobar.h b/Python/thread_foobar.h
index 754eb26bbe..e2c75e3b07 100644
--- a/Python/thread_foobar.h
+++ b/Python/thread_foobar.h
@@ -32,33 +32,33 @@ PERFORMANCE OF THIS SOFTWARE.
/*
* Initialization.
*/
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
}
/*
* Thread support.
*/
-int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
+int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
int success = 0; /* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
return success < 0 ? 0 : 1;
}
-long get_thread_ident _P0()
+long PyThread_get_thread_ident _P0()
{
if (!initialized)
- init_thread();
+ PyThread_init_thread();
}
-static void do_exit_thread _P1(no_cleanup, int no_cleanup)
+static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
{
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -66,20 +66,20 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
exit(0);
}
-void exit_thread _P0()
+void PyThread_exit_thread _P0()
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread _P0()
+void PyThread__exit_thread _P0()
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
+static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -87,76 +87,76 @@ static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
exit(status);
}
-void exit_prog _P1(status, int status)
+void PyThread_exit_prog _P1(status, int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(status, int status)
+void PyThread__exit_prog _P1(status, int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/*
* Lock support.
*/
-type_lock allocate_lock _P0()
+PyThread_type_lock PyThread_allocate_lock _P0()
{
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void free_lock _P1(lock, type_lock lock)
+void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
}
-int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
+int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{
int success;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void release_lock _P1(lock, type_lock lock)
+void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
}
/*
* Semaphore support.
*/
-type_sema allocate_sema _P1(value, int value)
+PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
{
- dprintf(("allocate_sema called\n"));
+ dprintf(("PyThread_allocate_sema called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void free_sema _P1(sema, type_sema sema)
+void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
}
-int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
+int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{
- dprintf(("down_sema(%lx, %d) called\n", (long) sema, waitflag));
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag));
+ dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
return -1;
}
-void up_sema _P1(sema, type_sema sema)
+void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
}
diff --git a/Python/thread_lwp.h b/Python/thread_lwp.h
index 1f2f47655b..5ad4df4856 100644
--- a/Python/thread_lwp.h
+++ b/Python/thread_lwp.h
@@ -46,7 +46,7 @@ struct lock {
/*
* Initialization.
*/
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
lwp_setstkcache(STACKSIZE, NSTACKS);
}
@@ -56,30 +56,30 @@ static void _init_thread _P0()
*/
-int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
+int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
thread_t tid;
int success;
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
success = lwp_create(&tid, func, MINPRIO, 0, lwp_newstk(), 1, arg);
return success < 0 ? 0 : 1;
}
-long get_thread_ident _P0()
+long PyThread_get_thread_ident _P0()
{
thread_t tid;
if (!initialized)
- init_thread();
+ PyThread_init_thread();
if (lwp_self(&tid) < 0)
return -1;
return tid.thread_id;
}
-static void do_exit_thread _P1(no_cleanup, int no_cleanup)
+static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
{
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -88,20 +88,20 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
lwp_destroy(SELF);
}
-void exit_thread _P0()
+void PyThread_exit_thread _P0()
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread _P0()
+void PyThread__exit_thread _P0()
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
+static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -110,49 +110,49 @@ static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
pod_exit(status);
}
-void exit_prog _P1(status, int status)
+void PyThread_exit_prog _P1(status, int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(status, int status)
+void PyThread__exit_prog _P1(status, int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/*
* Lock support.
*/
-type_lock allocate_lock _P0()
+PyThread_type_lock PyThread_allocate_lock _P0()
{
struct lock *lock;
extern char *malloc();
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
lock = (struct lock *) malloc(sizeof(struct lock));
lock->lock_locked = 0;
(void) mon_create(&lock->lock_monitor);
(void) cv_create(&lock->lock_condvar, lock->lock_monitor);
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void free_lock _P1(lock, type_lock lock)
+void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
mon_destroy(((struct lock *) lock)->lock_monitor);
free((char *) lock);
}
-int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
+int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{
int success;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
success = 0;
(void) mon_enter(((struct lock *) lock)->lock_monitor);
@@ -165,13 +165,13 @@ int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
}
cv_broadcast(((struct lock *) lock)->lock_condvar);
mon_exit(((struct lock *) lock)->lock_monitor);
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void release_lock _P1(lock, type_lock lock)
+void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
(void) mon_enter(((struct lock *) lock)->lock_monitor);
((struct lock *) lock)->lock_locked = 0;
cv_broadcast(((struct lock *) lock)->lock_condvar);
@@ -181,30 +181,30 @@ void release_lock _P1(lock, type_lock lock)
/*
* Semaphore support.
*/
-type_sema allocate_sema _P1(value, int value)
+PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
{
- type_sema sema = 0;
- dprintf(("allocate_sema called\n"));
+ PyThread_type_sema sema = 0;
+ dprintf(("PyThread_allocate_sema called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void free_sema _P1(sema, type_sema sema)
+void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
}
-int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
+int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{
- dprintf(("down_sema(%lx, %d) called\n", (long) sema, waitflag));
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag));
+ dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
return -1;
}
-void up_sema _P1(sema, type_sema sema)
+void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
}
diff --git a/Python/thread_nt.h b/Python/thread_nt.h
index 194298d5f1..0044551c90 100644
--- a/Python/thread_nt.h
+++ b/Python/thread_nt.h
@@ -35,7 +35,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include <limits.h>
#include <process.h>
-long get_thread_ident(void);
+long PyThread_get_thread_ident(void);
/*
* Change all headers to pure ANSI as no one will use K&R style on an
@@ -45,27 +45,27 @@ long get_thread_ident(void);
/*
* Initialization of the C package, should not be needed.
*/
-static void _init_thread(void)
+static void PyThread__init_thread(void)
{
}
/*
* Thread support.
*/
-int start_new_thread(void (*func)(void *), void *arg)
+int PyThread_start_new_thread(void (*func)(void *), void *arg)
{
long rv;
int success = 0;
- dprintf(("%ld: start_new_thread called\n", get_thread_ident()));
+ dprintf(("%ld: PyThread_start_new_thread called\n", PyThread_get_thread_ident()));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
rv = _beginthread(func, 0, arg); /* use default stack size */
if (rv != -1) {
success = 1;
- dprintf(("%ld: start_new_thread succeeded: %ld\n", get_thread_ident(), aThreadId));
+ dprintf(("%ld: PyThread_start_new_thread succeeded: %ld\n", PyThread_get_thread_ident(), aThreadId));
}
return success;
@@ -75,17 +75,17 @@ int start_new_thread(void (*func)(void *), void *arg)
* Return the thread Id instead of an handle. The Id is said to uniquely identify the
* thread in the system
*/
-long get_thread_ident(void)
+long PyThread_get_thread_ident(void)
{
if (!initialized)
- init_thread();
+ PyThread_init_thread();
return GetCurrentThreadId();
}
-static void do_exit_thread(int no_cleanup)
+static void do_PyThread_exit_thread(int no_cleanup)
{
- dprintf(("%ld: exit_thread called\n", get_thread_ident()));
+ dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident()));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -94,20 +94,20 @@ static void do_exit_thread(int no_cleanup)
_endthread();
}
-void exit_thread(void)
+void PyThread_exit_thread(void)
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread(void)
+void PyThread__exit_thread(void)
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog(int status, int no_cleanup)
+static void do_PyThread_exit_prog(int status, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -115,14 +115,14 @@ static void do_exit_prog(int status, int no_cleanup)
exit(status);
}
-void exit_prog(int status)
+void PyThread_exit_prog(int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(int status)
+void PyThread__exit_prog _P1(int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
@@ -131,13 +131,13 @@ void _exit_prog _P1(int status)
* I [Dag] tried to implement it with mutex but I could find a way to
* tell whether a thread already own the lock or not.
*/
-type_lock allocate_lock(void)
+PyThread_type_lock PyThread_allocate_lock(void)
{
HANDLE aLock;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
aLock = CreateSemaphore(NULL, /* Security attributes */
1, /* Initial value */
@@ -145,14 +145,14 @@ type_lock allocate_lock(void)
NULL);
/* Name of semaphore */
- dprintf(("%ld: allocate_lock() -> %lx\n", get_thread_ident(), (long)aLock));
+ dprintf(("%ld: PyThread_allocate_lock() -> %lx\n", PyThread_get_thread_ident(), (long)aLock));
- return (type_lock) aLock;
+ return (PyThread_type_lock) aLock;
}
-void free_lock(type_lock aLock)
+void PyThread_free_lock(PyThread_type_lock aLock)
{
- dprintf(("%ld: free_lock(%lx) called\n", get_thread_ident(),(long)aLock));
+ dprintf(("%ld: PyThread_free_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock));
CloseHandle((HANDLE) aLock);
}
@@ -163,12 +163,12 @@ void free_lock(type_lock aLock)
* and 0 if the lock was not acquired. This means a 0 is returned
* if the lock has already been acquired by this thread!
*/
-int acquire_lock(type_lock aLock, int waitflag)
+int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
{
int success = 1;
DWORD waitResult;
- dprintf(("%ld: acquire_lock(%lx, %d) called\n", get_thread_ident(),(long)aLock, waitflag));
+ dprintf(("%ld: PyThread_acquire_lock(%lx, %d) called\n", PyThread_get_thread_ident(),(long)aLock, waitflag));
waitResult = WaitForSingleObject((HANDLE) aLock, (waitflag == 1 ? INFINITE : 0));
@@ -176,48 +176,48 @@ int acquire_lock(type_lock aLock, int waitflag)
success = 0; /* We failed */
}
- dprintf(("%ld: acquire_lock(%lx, %d) -> %d\n", get_thread_ident(),(long)aLock, waitflag, success));
+ dprintf(("%ld: PyThread_acquire_lock(%lx, %d) -> %d\n", PyThread_get_thread_ident(),(long)aLock, waitflag, success));
return success;
}
-void release_lock(type_lock aLock)
+void PyThread_release_lock(PyThread_type_lock aLock)
{
- dprintf(("%ld: release_lock(%lx) called\n", get_thread_ident(),(long)aLock));
+ dprintf(("%ld: PyThread_release_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock));
if (!ReleaseSemaphore(
(HANDLE) aLock, /* Handle of semaphore */
1, /* increment count by one */
NULL)) /* not interested in previous count */
{
- dprintf(("%ld: Could not release_lock(%lx) error: %l\n", get_thread_ident(), (long)aLock, GetLastError()));
+ dprintf(("%ld: Could not PyThread_release_lock(%lx) error: %l\n", PyThread_get_thread_ident(), (long)aLock, GetLastError()));
}
}
/*
* Semaphore support.
*/
-type_sema allocate_sema(int value)
+PyThread_type_sema PyThread_allocate_sema(int value)
{
HANDLE aSemaphore;
- dprintf(("%ld: allocate_sema called\n", get_thread_ident()));
+ dprintf(("%ld: PyThread_allocate_sema called\n", PyThread_get_thread_ident()));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
aSemaphore = CreateSemaphore( NULL, /* Security attributes */
value, /* Initial value */
INT_MAX, /* Maximum value */
NULL); /* Name of semaphore */
- dprintf(("%ld: allocate_sema() -> %lx\n", get_thread_ident(), (long)aSemaphore));
+ dprintf(("%ld: PyThread_allocate_sema() -> %lx\n", PyThread_get_thread_ident(), (long)aSemaphore));
- return (type_sema) aSemaphore;
+ return (PyThread_type_sema) aSemaphore;
}
-void free_sema(type_sema aSemaphore)
+void PyThread_free_sema(PyThread_type_sema aSemaphore)
{
- dprintf(("%ld: free_sema(%lx) called\n", get_thread_ident(), (long)aSemaphore));
+ dprintf(("%ld: PyThread_free_sema(%lx) called\n", PyThread_get_thread_ident(), (long)aSemaphore));
CloseHandle((HANDLE) aSemaphore);
}
@@ -225,24 +225,24 @@ void free_sema(type_sema aSemaphore)
/*
XXX must do something about waitflag
*/
-int down_sema(type_sema aSemaphore, int waitflag)
+int PyThread_down_sema(PyThread_type_sema aSemaphore, int waitflag)
{
DWORD waitResult;
- dprintf(("%ld: down_sema(%lx) called\n", get_thread_ident(), (long)aSemaphore));
+ dprintf(("%ld: PyThread_down_sema(%lx) called\n", PyThread_get_thread_ident(), (long)aSemaphore));
waitResult = WaitForSingleObject( (HANDLE) aSemaphore, INFINITE);
- dprintf(("%ld: down_sema(%lx) return: %l\n", get_thread_ident(),(long) aSemaphore, waitResult));
+ dprintf(("%ld: PyThread_down_sema(%lx) return: %l\n", PyThread_get_thread_ident(),(long) aSemaphore, waitResult));
return 0;
}
-void up_sema(type_sema aSemaphore)
+void PyThread_up_sema(PyThread_type_sema aSemaphore)
{
ReleaseSemaphore(
(HANDLE) aSemaphore, /* Handle of semaphore */
1, /* increment count by one */
NULL); /* not interested in previous count */
- dprintf(("%ld: up_sema(%lx)\n", get_thread_ident(), (long)aSemaphore));
+ dprintf(("%ld: PyThread_up_sema(%lx)\n", PyThread_get_thread_ident(), (long)aSemaphore));
}
diff --git a/Python/thread_os2.h b/Python/thread_os2.h
index d52b236c87..982fb6f5bf 100644
--- a/Python/thread_os2.h
+++ b/Python/thread_os2.h
@@ -38,20 +38,20 @@ PERFORMANCE OF THIS SOFTWARE.
#include "process.h"
-long get_thread_ident(void);
+long PyThread_get_thread_ident(void);
/*
* Initialization of the C package, should not be needed.
*/
-static void _init_thread(void)
+static void PyThread__init_thread(void)
{
}
/*
* Thread support.
*/
-int start_new_thread(void (*func)(void *), void *arg)
+int PyThread_start_new_thread(void (*func)(void *), void *arg)
{
int aThread;
int success = 1;
@@ -67,21 +67,21 @@ int start_new_thread(void (*func)(void *), void *arg)
return success;
}
-long get_thread_ident(void)
+long PyThread_get_thread_ident(void)
{
PPIB pib;
PTIB tib;
if (!initialized)
- init_thread();
+ PyThread_init_thread();
DosGetInfoBlocks(&tib,&pib);
return tib->tib_ptib2->tib2_ultid;
}
-static void do_exit_thread(int no_cleanup)
+static void do_PyThread_exit_thread(int no_cleanup)
{
- dprintf(("%ld: exit_thread called\n", get_thread_ident()));
+ dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident()));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -90,20 +90,20 @@ static void do_exit_thread(int no_cleanup)
_endthread();
}
-void exit_thread(void)
+void PyThread_exit_thread(void)
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread(void)
+void PyThread__exit_thread(void)
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog(int status, int no_cleanup)
+static void do_PyThread_exit_prog(int status, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -111,14 +111,14 @@ static void do_exit_prog(int status, int no_cleanup)
exit(status);
}
-void exit_prog(int status)
+void PyThread_exit_prog(int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(int status)
+void PyThread__exit_prog _P1(int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
@@ -127,28 +127,28 @@ void _exit_prog _P1(int status)
* I [Dag] tried to implement it with mutex but I could find a way to
* tell whether a thread already own the lock or not.
*/
-type_lock allocate_lock(void)
+PyThread_type_lock PyThread_allocate_lock(void)
{
HMTX aLock;
APIRET rc;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
DosCreateMutexSem(NULL, /* Sem name */
&aLock, /* the semaphone */
0, /* shared ? */
0); /* initial state */
- dprintf(("%ld: allocate_lock() -> %lx\n", get_thread_ident(), (long)aLock));
+ dprintf(("%ld: PyThread_allocate_lock() -> %lx\n", PyThread_get_thread_ident(), (long)aLock));
- return (type_lock) aLock;
+ return (PyThread_type_lock) aLock;
}
-void free_lock(type_lock aLock)
+void PyThread_free_lock(PyThread_type_lock aLock)
{
- dprintf(("%ld: free_lock(%lx) called\n", get_thread_ident(),(long)aLock));
+ dprintf(("%ld: PyThread_free_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock));
DosCloseMutexSem((HMTX)aLock);
}
@@ -159,18 +159,18 @@ void free_lock(type_lock aLock)
* and 0 if the lock was not acquired. This means a 0 is returned
* if the lock has already been acquired by this thread!
*/
-int acquire_lock(type_lock aLock, int waitflag)
+int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
{
int success = 1;
ULONG rc, count;
PID pid = 0;
TID tid = 0;
- dprintf(("%ld: acquire_lock(%lx, %d) called\n", get_thread_ident(),
+ dprintf(("%ld: PyThread_acquire_lock(%lx, %d) called\n", PyThread_get_thread_ident(),
(long)aLock, waitflag));
DosQueryMutexSem((HMTX)aLock,&pid,&tid,&count);
- if( tid == get_thread_ident() ) { /* if we own this lock */
+ if( tid == PyThread_get_thread_ident() ) { /* if we own this lock */
success = 0;
} else {
rc = DosRequestMutexSem((HMTX) aLock,
@@ -181,41 +181,41 @@ int acquire_lock(type_lock aLock, int waitflag)
}
}
- dprintf(("%ld: acquire_lock(%lx, %d) -> %d\n",
- get_thread_ident(),(long)aLock, waitflag, success));
+ dprintf(("%ld: PyThread_acquire_lock(%lx, %d) -> %d\n",
+ PyThread_get_thread_ident(),(long)aLock, waitflag, success));
return success;
}
-void release_lock(type_lock aLock)
+void PyThread_release_lock(PyThread_type_lock aLock)
{
- dprintf(("%ld: release_lock(%lx) called\n", get_thread_ident(),(long)aLock));
+ dprintf(("%ld: PyThread_release_lock(%lx) called\n", PyThread_get_thread_ident(),(long)aLock));
if ( DosReleaseMutexSem( (HMTX) aLock ) != 0 ) {
- dprintf(("%ld: Could not release_lock(%lx) error: %l\n",
- get_thread_ident(), (long)aLock, GetLastError()));
+ dprintf(("%ld: Could not PyThread_release_lock(%lx) error: %l\n",
+ PyThread_get_thread_ident(), (long)aLock, GetLastError()));
}
}
/*
* Semaphore support.
*/
-type_sema allocate_sema(int value)
+PyThread_type_sema PyThread_allocate_sema(int value)
{
- return (type_sema) 0;
+ return (PyThread_type_sema) 0;
}
-void free_sema(type_sema aSemaphore)
+void PyThread_free_sema(PyThread_type_sema aSemaphore)
{
}
-int down_sema(type_sema aSemaphore, int waitflag)
+int PyThread_down_sema(PyThread_type_sema aSemaphore, int waitflag)
{
return -1;
}
-void up_sema(type_sema aSemaphore)
+void PyThread_up_sema(PyThread_type_sema aSemaphore)
{
- dprintf(("%ld: up_sema(%lx)\n", get_thread_ident(), (long)aSemaphore));
+ dprintf(("%ld: PyThread_up_sema(%lx)\n", PyThread_get_thread_ident(), (long)aSemaphore));
}
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 71ae66d6c8..0b4041a3a9 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -125,7 +125,7 @@ static void _noop()
{
}
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
/* DO AN INIT BY STARTING THE THREAD */
static int dummy = 0;
@@ -136,7 +136,7 @@ static void _init_thread _P0()
#else /* !_HAVE_BSDI */
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
#if defined(_AIX) && defined(__GNUC__)
pthread_init();
@@ -150,13 +150,13 @@ static void _init_thread _P0()
*/
-int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
+int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
pthread_t th;
int success;
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
success = pthread_create(&th,
#if defined(PY_PTHREAD_D4)
@@ -188,19 +188,19 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
-long get_thread_ident _P0()
+long PyThread_get_thread_ident _P0()
{
volatile pthread_t threadid;
if (!initialized)
- init_thread();
+ PyThread_init_thread();
/* Jump through some hoops for Alpha OSF/1 */
threadid = pthread_self();
return (long) *(long *) &threadid;
}
-static void do_exit_thread _P1(no_cleanup, int no_cleanup)
+static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
{
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
if (!initialized) {
if (no_cleanup)
_exit(0);
@@ -209,20 +209,20 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
}
}
-void exit_thread _P0()
+void PyThread_exit_thread _P0()
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread _P0()
+void PyThread__exit_thread _P0()
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
+static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -230,28 +230,28 @@ static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
exit(status);
}
-void exit_prog _P1(status, int status)
+void PyThread_exit_prog _P1(status, int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(status, int status)
+void PyThread__exit_prog _P1(status, int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/*
* Lock support.
*/
-type_lock allocate_lock _P0()
+PyThread_type_lock PyThread_allocate_lock _P0()
{
pthread_lock *lock;
int status, error = 0;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
lock = (pthread_lock *) malloc(sizeof(pthread_lock));
memset((void *)lock, '\0', sizeof(pthread_lock));
@@ -272,16 +272,16 @@ type_lock allocate_lock _P0()
}
}
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void free_lock _P1(lock, type_lock lock)
+void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{
pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0;
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
status = pthread_mutex_destroy( &thelock->mut );
CHECK_STATUS("pthread_mutex_destroy");
@@ -292,13 +292,13 @@ void free_lock _P1(lock, type_lock lock)
free((void *)thelock);
}
-int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
+int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{
int success;
pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
status = pthread_mutex_lock( &thelock->mut );
CHECK_STATUS("pthread_mutex_lock[1]");
@@ -325,16 +325,16 @@ int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
success = 1;
}
if (error) success = 0;
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void release_lock _P1(lock, type_lock lock)
+void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{
pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0;
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
status = pthread_mutex_lock( &thelock->mut );
CHECK_STATUS("pthread_mutex_lock[3]");
@@ -359,14 +359,14 @@ struct semaphore {
int value;
};
-type_sema allocate_sema _P1(value, int value)
+PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
{
struct semaphore *sema;
int status, error = 0;
- dprintf(("allocate_sema called\n"));
+ dprintf(("PyThread_allocate_sema called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
sema = (struct semaphore *) malloc(sizeof(struct semaphore));
if (sema != NULL) {
@@ -382,16 +382,16 @@ type_sema allocate_sema _P1(value, int value)
sema = NULL;
}
}
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void free_sema _P1(sema, type_sema sema)
+void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{
int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema;
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
status = pthread_cond_destroy(&thesema->cond);
CHECK_STATUS("pthread_cond_destroy");
status = pthread_mutex_destroy(&thesema->mutex);
@@ -399,12 +399,12 @@ void free_sema _P1(sema, type_sema sema)
free((void *) thesema);
}
-int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
+int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{
int status, error = 0, success;
struct semaphore *thesema = (struct semaphore *) sema;
- dprintf(("down_sema(%lx, %d) called\n", (long) sema, waitflag));
+ dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag));
status = pthread_mutex_lock(&thesema->mutex);
CHECK_STATUS("pthread_mutex_lock");
if (waitflag) {
@@ -424,16 +424,16 @@ int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
success = 0;
status = pthread_mutex_unlock(&thesema->mutex);
CHECK_STATUS("pthread_mutex_unlock");
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
return success;
}
-void up_sema _P1(sema, type_sema sema)
+void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{
int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema;
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
status = pthread_mutex_lock(&thesema->mutex);
CHECK_STATUS("pthread_mutex_lock");
thesema->value++;
diff --git a/Python/thread_sgi.h b/Python/thread_sgi.h
index a53c8dc65d..a7b3114b36 100644
--- a/Python/thread_sgi.h
+++ b/Python/thread_sgi.h
@@ -66,7 +66,7 @@ static int maxpidindex; /* # of PIDs in pidlist */
/*
* This routine is called as a signal handler when another thread
* exits. When that happens, we must see whether we have to exit as
- * well (because of an exit_prog()) or whether we should continue on.
+ * well (because of an PyThread_exit_prog()) or whether we should continue on.
*/
static void exit_sig _P0()
{
@@ -81,13 +81,13 @@ static void exit_sig _P0()
if ((thread_debug & 8) == 0)
thread_debug &= ~1; /* don't produce debug messages */
#endif
- exit_thread();
+ PyThread_exit_thread();
}
}
/*
* This routine is called when a process calls exit(). If that wasn't
- * done from the library, we do as if an exit_prog() was intended.
+ * done from the library, we do as if an PyThread_exit_prog() was intended.
*/
static void maybe_exit _P0()
{
@@ -96,14 +96,14 @@ static void maybe_exit _P0()
dprintf(("already exiting\n"));
return;
}
- exit_prog(0);
+ PyThread_exit_prog(0);
}
#endif /* NO_EXIT_PROG */
/*
* Initialization.
*/
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
#ifndef NO_EXIT_PROG
struct sigaction s;
@@ -198,7 +198,7 @@ static void clean_threads _P0()
}
}
-int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
+int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
#ifdef USE_DL
long addr, size;
@@ -207,9 +207,9 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
int success = 0; /* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
switch (ussetlock(count_lock)) {
case 0: return 0;
case -1: perror("ussetlock (count_lock)");
@@ -256,14 +256,14 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
-long get_thread_ident _P0()
+long PyThread_get_thread_ident _P0()
{
return getpid();
}
-static void do_exit_thread _P1(no_cleanup, int no_cleanup)
+static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
{
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -326,20 +326,20 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
_exit(0);
}
-void exit_thread _P0()
+void PyThread_exit_thread _P0()
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread _P0()
+void PyThread__exit_thread _P0()
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
+static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -347,49 +347,49 @@ static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
exit(status);
do_exit = 1;
exit_status = status;
- do_exit_thread(no_cleanup);
+ do_PyThread_exit_thread(no_cleanup);
}
-void exit_prog _P1(status, int status)
+void PyThread_exit_prog _P1(status, int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(status, int status)
+void PyThread__exit_prog _P1(status, int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/*
* Lock support.
*/
-type_lock allocate_lock _P0()
+PyThread_type_lock PyThread_allocate_lock _P0()
{
ulock_t lock;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
if ((lock = usnewlock(shared_arena)) == NULL)
perror("usnewlock");
(void) usinitlock(lock);
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void free_lock _P1(lock, type_lock lock)
+void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
usfreelock((ulock_t) lock, shared_arena);
}
-int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
+int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{
int success;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
errno = 0; /* clear it just in case */
if (waitflag)
success = ussetlock((ulock_t) lock);
@@ -397,13 +397,13 @@ int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
success = uscsetlock((ulock_t) lock, 1); /* Try it once */
if (success < 0)
perror(waitflag ? "ussetlock" : "uscsetlock");
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void release_lock _P1(lock, type_lock lock)
+void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
if (usunsetlock((ulock_t) lock) < 0)
perror("usunsetlock");
}
@@ -411,43 +411,43 @@ void release_lock _P1(lock, type_lock lock)
/*
* Semaphore support.
*/
-type_sema allocate_sema _P1(value, int value)
+PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
{
usema_t *sema;
- dprintf(("allocate_sema called\n"));
+ dprintf(("PyThread_allocate_sema called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
if ((sema = usnewsema(shared_arena, value)) == NULL)
perror("usnewsema");
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void free_sema _P1(sema, type_sema sema)
+void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
usfreesema((usema_t *) sema, shared_arena);
}
-int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
+int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{
int success;
- dprintf(("down_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx) called\n", (long) sema));
if (waitflag)
success = uspsema((usema_t *) sema);
else
success = uscpsema((usema_t *) sema);
if (success < 0)
perror(waitflag ? "uspsema" : "uscpsema");
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
return success;
}
-void up_sema _P1(sema, type_sema sema)
+void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
if (usvsema((usema_t *) sema) < 0)
perror("usvsema");
}
@@ -465,12 +465,12 @@ struct key {
static struct key *keyhead = NULL;
static int nkeys = 0;
-static type_lock keymutex = NULL;
+static PyThread_type_lock keymutex = NULL;
static struct key *find_key _P2(key, int key, value, void *value)
{
struct key *p;
- long id = get_thread_ident();
+ long id = PyThread_get_thread_ident();
for (p = keyhead; p != NULL; p = p->next) {
if (p->id == id && p->key == key)
return p;
@@ -482,25 +482,25 @@ static struct key *find_key _P2(key, int key, value, void *value)
p->id = id;
p->key = key;
p->value = value;
- acquire_lock(keymutex, 1);
+ PyThread_acquire_lock(keymutex, 1);
p->next = keyhead;
keyhead = p;
- release_lock(keymutex);
+ PyThread_release_lock(keymutex);
}
return p;
}
-int create_key _P0()
+int PyThread_create_key _P0()
{
if (keymutex == NULL)
- keymutex = allocate_lock();
+ keymutex = PyThread_allocate_lock();
return ++nkeys;
}
-void delete_key _P1(key, int key)
+void PyThread_delete_key _P1(key, int key)
{
struct key *p, **q;
- acquire_lock(keymutex, 1);
+ PyThread_acquire_lock(keymutex, 1);
q = &keyhead;
while ((p = *q) != NULL) {
if (p->key == key) {
@@ -511,10 +511,10 @@ void delete_key _P1(key, int key)
else
q = &p->next;
}
- release_lock(keymutex);
+ PyThread_release_lock(keymutex);
}
-int set_key_value _P2(key, int key, value, void *value)
+int PyThread_set_key_value _P2(key, int key, value, void *value)
{
struct key *p = find_key(key, value);
if (p == NULL)
@@ -523,7 +523,7 @@ int set_key_value _P2(key, int key, value, void *value)
return 0;
}
-void *get_key_value _P1(key, int key)
+void *PyThread_get_key_value _P1(key, int key)
{
struct key *p = find_key(key, NULL);
if (p == NULL)
diff --git a/Python/thread_solaris.h b/Python/thread_solaris.h
index c1740ce71b..e902245faa 100644
--- a/Python/thread_solaris.h
+++ b/Python/thread_solaris.h
@@ -40,7 +40,7 @@ PERFORMANCE OF THIS SOFTWARE.
/*
* Initialization.
*/
-static void _init_thread _P0()
+static void PyThread__init_thread _P0()
{
}
@@ -65,15 +65,15 @@ static void *new_func _P1(funcarg, void *funcarg)
}
-int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
+int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
{
struct func_arg *funcarg;
int success = 0; /* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */
- dprintf(("start_new_thread called\n"));
+ dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
funcarg = (struct func_arg *) malloc(sizeof(struct func_arg));
funcarg->func = func;
funcarg->arg = arg;
@@ -85,16 +85,16 @@ int start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
return success < 0 ? 0 : 1;
}
-long get_thread_ident _P0()
+long PyThread_get_thread_ident _P0()
{
if (!initialized)
- init_thread();
+ PyThread_init_thread();
return thr_self();
}
-static void do_exit_thread _P1(no_cleanup, int no_cleanup)
+static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
{
- dprintf(("exit_thread called\n"));
+ dprintf(("PyThread_exit_thread called\n"));
if (!initialized)
if (no_cleanup)
_exit(0);
@@ -103,20 +103,20 @@ static void do_exit_thread _P1(no_cleanup, int no_cleanup)
thr_exit(0);
}
-void exit_thread _P0()
+void PyThread_exit_thread _P0()
{
- do_exit_thread(0);
+ do_PyThread_exit_thread(0);
}
-void _exit_thread _P0()
+void PyThread__exit_thread _P0()
{
- do_exit_thread(1);
+ do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
-static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
+static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
{
- dprintf(("exit_prog(%d) called\n", status));
+ dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized)
if (no_cleanup)
_exit(status);
@@ -128,27 +128,27 @@ static void do_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
exit(status);
}
-void exit_prog _P1(status, int status)
+void PyThread_exit_prog _P1(status, int status)
{
- do_exit_prog(status, 0);
+ do_PyThread_exit_prog(status, 0);
}
-void _exit_prog _P1(status, int status)
+void PyThread__exit_prog _P1(status, int status)
{
- do_exit_prog(status, 1);
+ do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/*
* Lock support.
*/
-type_lock allocate_lock _P0()
+PyThread_type_lock PyThread_allocate_lock _P0()
{
mutex_t *lock;
- dprintf(("allocate_lock called\n"));
+ dprintf(("PyThread_allocate_lock called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
lock = (mutex_t *) malloc(sizeof(mutex_t));
if (mutex_init(lock, USYNC_THREAD, 0)) {
@@ -156,22 +156,22 @@ type_lock allocate_lock _P0()
free((void *) lock);
lock = 0;
}
- dprintf(("allocate_lock() -> %lx\n", (long)lock));
- return (type_lock) lock;
+ dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
+ return (PyThread_type_lock) lock;
}
-void free_lock _P1(lock, type_lock lock)
+void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("free_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
mutex_destroy((mutex_t *) lock);
free((void *) lock);
}
-int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
+int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
{
int success;
- dprintf(("acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
+ dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
if (waitflag)
success = mutex_lock((mutex_t *) lock);
else
@@ -180,13 +180,13 @@ int acquire_lock _P2(lock, type_lock lock, waitflag, int waitflag)
perror(waitflag ? "mutex_lock" : "mutex_trylock");
else
success = !success; /* solaris does it the other way round */
- dprintf(("acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
+ dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
return success;
}
-void release_lock _P1(lock, type_lock lock)
+void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
{
- dprintf(("release_lock(%lx) called\n", (long)lock));
+ dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
if (mutex_unlock((mutex_t *) lock))
perror("mutex_unlock");
}
@@ -194,12 +194,12 @@ void release_lock _P1(lock, type_lock lock)
/*
* Semaphore support.
*/
-type_sema allocate_sema _P1(value, int value)
+PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
{
sema_t *sema;
- dprintf(("allocate_sema called\n"));
+ dprintf(("PyThread_allocate_sema called\n"));
if (!initialized)
- init_thread();
+ PyThread_init_thread();
sema = (sema_t *) malloc(sizeof(sema_t));
if (sema_init(sema, value, USYNC_THREAD, 0)) {
@@ -207,23 +207,23 @@ type_sema allocate_sema _P1(value, int value)
free((void *) sema);
sema = 0;
}
- dprintf(("allocate_sema() -> %lx\n", (long) sema));
- return (type_sema) sema;
+ dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
+ return (PyThread_type_sema) sema;
}
-void free_sema _P1(sema, type_sema sema)
+void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("free_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
if (sema_destroy((sema_t *) sema))
perror("sema_destroy");
free((void *) sema);
}
-int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
+int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
{
int success;
- dprintf(("down_sema(%lx) called\n", (long) sema));
+ dprintf(("PyThread_down_sema(%lx) called\n", (long) sema));
if (waitflag)
success = sema_wait((sema_t *) sema);
else
@@ -236,13 +236,13 @@ int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
}
else
success = !success;
- dprintf(("down_sema(%lx) return %d\n", (long) sema, success));
+ dprintf(("PyThread_down_sema(%lx) return %d\n", (long) sema, success));
return success;
}
-void up_sema _P1(sema, type_sema sema)
+void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
{
- dprintf(("up_sema(%lx)\n", (long) sema));
+ dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
if (sema_post((sema_t *) sema))
perror("sema_post");
}