mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +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
|
|
@ -285,73 +285,3 @@ void PyThread_release_lock( PyThread_type_lock lock )
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Semaphore support.
|
||||
*
|
||||
* Guido says not to implement this because it's not used anywhere;
|
||||
* I'll do it anyway, you never know when it might be handy, and it's
|
||||
* easy...
|
||||
*/
|
||||
PyThread_type_sema PyThread_allocate_sema( int value )
|
||||
{
|
||||
sem_id sema;
|
||||
|
||||
dprintf(("PyThread_allocate_sema called\n"));
|
||||
|
||||
sema = create_sem( value, "python semaphore" );
|
||||
if( sema < B_NO_ERROR ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintf(("PyThread_allocate_sema() -> %p\n", sema));
|
||||
return (PyThread_type_sema) sema;
|
||||
}
|
||||
|
||||
void PyThread_free_sema( PyThread_type_sema sema )
|
||||
{
|
||||
status_t retval;
|
||||
|
||||
dprintf(("PyThread_free_sema(%p) called\n", sema));
|
||||
|
||||
retval = delete_sem( (sem_id)sema );
|
||||
if( retval != B_NO_ERROR ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int PyThread_down_sema( PyThread_type_sema sema, int waitflag )
|
||||
{
|
||||
status_t retval;
|
||||
|
||||
dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
|
||||
|
||||
if( waitflag ) {
|
||||
retval = acquire_sem( (sem_id)sema );
|
||||
} else {
|
||||
retval = acquire_sem_etc( (sem_id)sema, 1, B_TIMEOUT, 0 );
|
||||
}
|
||||
|
||||
if( retval != B_NO_ERROR ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintf(("PyThread_down_sema(%p) return\n", sema));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void PyThread_up_sema( PyThread_type_sema sema )
|
||||
{
|
||||
status_t retval;
|
||||
|
||||
dprintf(("PyThread_up_sema(%p)\n", sema));
|
||||
|
||||
retval = release_sem( (sem_id)sema );
|
||||
if( retval != B_NO_ERROR ) {
|
||||
/* TODO: that's bad, raise an exception */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue