[issue5725] process SysV-Semaphore support

jvdias report at bugs.python.org
Thu Apr 9 16:41:59 CEST 2009


jvdias <jason.vas.dias at gmail.com> added the comment:

Contrast what I had to do to perform a process semaphore operation
in Python with how one would do it in PERL :

-- Perl 5.10.0 documentation --
Show toolbar
Home > Language reference > Functions > semop
semop
Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

    * semop KEY,OPSTRING

      Calls the System V IPC function semop to perform semaphore
operations such as signalling and waiting. OPSTRING must be a packed
array of semop structures. Each semop structure can be generated with
pack("s!3", $semnum, $semop, $semflag) . The length of OPSTRING implies
the number of semaphore operations. Returns true if successful, or false
if there is an error. As an example, the following code waits on
semaphore $semnum of semaphore id $semid:

          $semop = pack("s!3", $semnum, -1, 0);
          die "Semaphore trouble: $!\n" unless semop($semid, $semop);

      To signal the semaphore, replace -1 with 1 . See also "SysV IPC"
in perlipc, IPC::SysV , and IPC::SysV::Semaphore documentation.

Nice ! Why can't Python provide something similar ?

Then my example psempy.c module could be implemented in 100% pure
python.

I'm bringing this issue up here so as to gain some feedback from
the Python development team as to the likelihood of Python's Core
'sys' module ever supportting process-scope semaphores - if I don't
here back from them within three days I'll submit a patch for
Python to support the sys.semget(), sys.semctl(), and
sys.semop/sys.semtimedop operations as described above .

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5725>
_______________________________________


More information about the Python-bugs-list mailing list