Hi,

I've been trying to use SystemV Semaphores as a kind of locking system in a
webpage, but after a few hours I get this message:

Warning: semget() failed for key 0x0: No space left on device in
/1/home/xxxx/admin/htdocs/prop/lock.php on line 8

Warning: 0 is not a SysV semaphore index in
/1/home/xxxx/admin/htdocs/prop/lock.php on line 19

Couldn't grab lock!

It isn't disk space, and there's plenty of free memory. So how do I fix it
and stop it doing it in the future?

Apart from this it seems to work fine. I've attached some sample code which
is pretty much exactly what I'm doing.


Cheers

<? 
class Lock {

        var $lock = 1;
        var $id;

        function Lock() {
            $this->id = sem_get($lock);
        }

        function unLock() {
            sem_release($this->id);
            return 0;
        }

        function checkLock() {
            if(!sem_acquire($this->id)) {
                echo "Couldn't grab lock!";
                return -1;
            }
            return 0;
        }

}
?>
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to