summaryrefslogtreecommitdiffstats
path: root/Python/thread_pth.h
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-01-19 22:02:55 (GMT)
committerFred Drake <fdrake@acm.org>2002-01-19 22:02:55 (GMT)
commit7bb1c9a11db2ecdf58fed5a5e3a7cdea619d52db (patch)
treeedd4767d8b3b2126fcd0084d3ed1a321bdf9b3a9 /Python/thread_pth.h
parent72c3bf076f785aaf54d63a7e8cae29bc8282920e (diff)
downloadcpython-7bb1c9a11db2ecdf58fed5a5e3a7cdea619d52db.zip
cpython-7bb1c9a11db2ecdf58fed5a5e3a7cdea619d52db.tar.gz
cpython-7bb1c9a11db2ecdf58fed5a5e3a7cdea619d52db.tar.bz2
Remove the unused & broken PyThread_*_sema() functions and related constants.
This closes SF patch #504215.
Diffstat (limited to 'Python/thread_pth.h')
-rw-r--r--Python/thread_pth.h87
1 files changed, 0 insertions, 87 deletions
diff --git a/Python/thread_pth.h b/Python/thread_pth.h
index 71e0d04..3b97981 100644
--- a/Python/thread_pth.h
+++ b/Python/thread_pth.h
@@ -206,90 +206,3 @@ void PyThread_release_lock(PyThread_type_lock lock)
status = pth_cond_notify( &thelock->lock_released, 0 );
CHECK_STATUS("pth_cond_notify");
}
-
-/*
- * Semaphore support.
- */
-
-struct semaphore {
- pth_mutex_t mutex;
- pth_cond_t cond;
- int value;
-};
-
-PyThread_type_sema PyThread_allocate_sema(int value)
-{
- struct semaphore *sema;
- int status, error = 0;
-
- dprintf(("PyThread_allocate_sema called\n"));
- if (!initialized)
- PyThread_init_thread();
-
- sema = (struct semaphore *) malloc(sizeof(struct semaphore));
- if (sema != NULL) {
- sema->value = value;
- status = pth_mutex_init(&sema->mutex);
- CHECK_STATUS("pth_mutex_init");
- status = pth_cond_init(&sema->cond);
- CHECK_STATUS("pth_mutex_init");
- if (error) {
- free((void *) sema);
- sema = NULL;
- }
- }
- dprintf(("PyThread_allocate_sema() -> %p\n", sema));
- return (PyThread_type_sema) sema;
-}
-
-void PyThread_free_sema(PyThread_type_sema sema)
-{
- struct semaphore *thesema = (struct semaphore *) sema;
-
- dprintf(("PyThread_free_sema(%p) called\n", sema));
- free((void *) thesema);
-}
-
-int PyThread_down_sema(PyThread_type_sema sema, int waitflag)
-{
- int status, error = 0, success;
- struct semaphore *thesema = (struct semaphore *) sema;
-
- dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
- status = pth_mutex_acquire(&thesema->mutex, !waitflag, NULL);
- CHECK_STATUS("pth_mutex_acquire");
- if (waitflag) {
- while (!error && thesema->value <= 0) {
- status = pth_cond_await(&thesema->cond,
- &thesema->mutex, NULL);
- CHECK_STATUS("pth_cond_await");
- }
- }
- if (error)
- success = 0;
- else if (thesema->value > 0) {
- thesema->value--;
- success = 1;
- }
- else
- success = 0;
- status = pth_mutex_release(&thesema->mutex);
- CHECK_STATUS("pth_mutex_release");
- dprintf(("PyThread_down_sema(%p) return\n", sema));
- return success;
-}
-
-void PyThread_up_sema(PyThread_type_sema sema)
-{
- int status, error = 0;
- struct semaphore *thesema = (struct semaphore *) sema;
-
- dprintf(("PyThread_up_sema(%p)\n", sema));
- status = pth_mutex_acquire(&thesema->mutex, 0, NULL);
- CHECK_STATUS("pth_mutex_acquire");
- thesema->value++;
- status = pth_cond_notify(&thesema->cond, 1);
- CHECK_STATUS("pth_cond_notify");
- status = pth_mutex_release(&thesema->mutex);
- CHECK_STATUS("pth_mutex_release");
-}