summaryrefslogtreecommitdiffstats
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-12-21 19:32:43 (GMT)
committerGuido van Rossum <guido@python.org>1998-12-21 19:32:43 (GMT)
commit65d5b5763c6bbd99d2e2c6b219570f4562382ff0 (patch)
tree0a909da387c751fbfe8a90bb4a5a83f59f6c86a5 /Python/thread_pthread.h
parent14f53a77579d411b7b3f491f45753315e40f1aa9 (diff)
downloadcpython-65d5b5763c6bbd99d2e2c6b219570f4562382ff0.zip
cpython-65d5b5763c6bbd99d2e2c6b219570f4562382ff0.tar.gz
cpython-65d5b5763c6bbd99d2e2c6b219570f4562382ff0.tar.bz2
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).
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h86
1 files changed, 43 insertions, 43 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 71ae66d..0b4041a 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++;