koerberm@nixsin.UUCP (Mathias Koerber) (06/04/90)
Can I safely assume, that a contruct like while (shm_addr->flag == 0) ; shm_addr->flag = getpid(); ensures that only one of several equal processes at a time have access to a resource? I fear that one process finds the flag set to zero, but is running out of time-slice, before it can set the flag, and then another process also finds the flag set to zero and uses the resource. If the above example doesn't work, what works? I'd like to have a solution with shm, since I don't want to add even another IPC-system (semaphores etc) only for this to work. Please e-mail, address as in my (.sig). Thx, Mathias -- Mathias Koerber |Tel: +65 / 7473828 ext 1852|Fax: +65 / 7474331 Nixdorf Computer Singapore|EUnet: koerber.sin@nixpbe |nerv: koerber.sin 2 Kallang Sector |uunet: uunet!linus!nixbur!koerber.sin Singapore 1334 |[Standard-disclaimer:All views personal... ]