mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
Remove the unused & broken PyThread_*_sema() functions and related constants.
This closes SF patch #504215.
This commit is contained in:
parent
72c3bf076f
commit
7bb1c9a11d
11 changed files with 0 additions and 557 deletions
|
@ -174,63 +174,3 @@ PyThread_release_lock(PyThread_type_lock lock)
|
|||
if (mutex_unlock((mutex_t *) lock))
|
||||
perror("mutex_unlock");
|
||||
}
|
||||
|
||||
/*
|
||||
* Semaphore support.
|
||||
*/
|
||||
PyThread_type_sema
|
||||
PyThread_allocate_sema(int value)
|
||||
{
|
||||
sema_t *sema;
|
||||
dprintf(("PyThread_allocate_sema called\n"));
|
||||
if (!initialized)
|
||||
PyThread_init_thread();
|
||||
|
||||
sema = (sema_t *) malloc(sizeof(sema_t));
|
||||
if (sema_init(sema, value, USYNC_THREAD, 0)) {
|
||||
perror("sema_init");
|
||||
free((void *) sema);
|
||||
sema = 0;
|
||||
}
|
||||
dprintf(("PyThread_allocate_sema() -> %p\n", sema));
|
||||
return (PyThread_type_sema) sema;
|
||||
}
|
||||
|
||||
void
|
||||
PyThread_free_sema(PyThread_type_sema sema)
|
||||
{
|
||||
dprintf(("PyThread_free_sema(%p) called\n", sema));
|
||||
if (sema_destroy((sema_t *) sema))
|
||||
perror("sema_destroy");
|
||||
free((void *) sema);
|
||||
}
|
||||
|
||||
int
|
||||
PyThread_down_sema(PyThread_type_sema sema, int waitflag)
|
||||
{
|
||||
int success;
|
||||
|
||||
dprintf(("PyThread_down_sema(%p) called\n", sema));
|
||||
if (waitflag)
|
||||
success = sema_wait((sema_t *) sema);
|
||||
else
|
||||
success = sema_trywait((sema_t *) sema);
|
||||
if (success < 0) {
|
||||
if (errno == EBUSY)
|
||||
success = 0;
|
||||
else
|
||||
perror("sema_wait");
|
||||
}
|
||||
else
|
||||
success = !success;
|
||||
dprintf(("PyThread_down_sema(%p) return %d\n", sema, success));
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
PyThread_up_sema(PyThread_type_sema sema)
|
||||
{
|
||||
dprintf(("PyThread_up_sema(%p)\n", sema));
|
||||
if (sema_post((sema_t *) sema))
|
||||
perror("sema_post");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue