ktrivedi has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've been looking for some example code of IPC::Semaphore. Can somebody point it to me if possible ? Thanks

Replies are listed 'Best First'.
Re: IPC::Semaphore example
by BrowserUk (Patriarch) on Dec 03, 2004 at 07:13 UTC

    I have the Perl CD bookshelf (v3.0) which contains 7 of the most famous/popular/authoratative O'Reilly Perl books. I did a search to see what IPC::Semaphore related examples it may hold. The result was 1, barely described, example.

    However, it did turn up this quote from Programming Perl. Ch. 16.4 "System V IPC:

    Everyone hates System V IPC. It's slower than paper tape, carves out insidious little namespaces completely unrelated to the filesystem, uses human-hostile numbers to name its objects, and is constantly losing track of its own mind. Every so often, your sysadmin has to go on a search-and-destroy mission to hunt down these lost SysV IPC objects with ipcs(1) and kill them with ipcrm(1), hopefully before the system runs out of memory.

    However, it does mention IPC::Shareable, which if you take a quick look at the source, does make some fairly sophisticated use of IPC::Shareable.

    If the above warning hasn't put you off, you may find that IPC::Shareable is your best source (sic) of example code.


    Examine what is said, not who speaks.
    "But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
    "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
Re: IPC::Semaphore example
by ikegami (Patriarch) on Dec 03, 2004 at 06:45 UTC
    You should be able to find literature on Semaphores with little effort. Granted, those pages won't be using IPC::Semaphore, but the concept will be the same.