diff options
author | Guido van Rossum <guido@python.org> | 1998-12-21 19:32:43 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-12-21 19:32:43 (GMT) |
commit | 65d5b5763c6bbd99d2e2c6b219570f4562382ff0 (patch) | |
tree | 0a909da387c751fbfe8a90bb4a5a83f59f6c86a5 /Python | |
parent | 14f53a77579d411b7b3f491f45753315e40f1aa9 (diff) | |
download | cpython-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')
-rw-r--r-- | Python/ceval.c | 26 | ||||
-rw-r--r-- | Python/import.c | 14 | ||||
-rw-r--r-- | Python/importdl.c | 2 | ||||
-rw-r--r-- | Python/thread.c | 8 | ||||
-rw-r--r-- | Python/thread_beos.h | 68 | ||||
-rw-r--r-- | Python/thread_cthread.h | 84 | ||||
-rw-r--r-- | Python/thread_foobar.h | 84 | ||||
-rw-r--r-- | Python/thread_lwp.h | 86 | ||||
-rw-r--r-- | Python/thread_nt.h | 90 | ||||
-rw-r--r-- | Python/thread_os2.h | 78 | ||||
-rw-r--r-- | Python/thread_pthread.h | 86 | ||||
-rw-r--r-- | Python/thread_sgi.h | 114 | ||||
-rw-r--r-- | Python/thread_solaris.h | 84 |
13 files changed, 412 insertions, 412 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index b013ca1..f52eb0e 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 2707019..d35a8b7 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 dc97f67..dd0f154 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 2c20690..c533398 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 f2024f3..0dff786 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 3f48d59..11370c5 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 754eb26..e2c75e3 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 1f2f476..5ad4df4 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 194298d..0044551 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 d52b236..982fb6f 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 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++; diff --git a/Python/thread_sgi.h b/Python/thread_sgi.h index a53c8dc..a7b3114 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 c1740ce..e902245 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"); } |