On Mon, 23 Aug 1999, Christopher Masto wrote:

> Bleah.. I can't count the number of times I've seen idiotic code like:
> 
> open file
> read data
> close file
> open file for write
> write data
> close file
> 
> Mandatory locking of the type above doesn't force such a thing to work.

What has that code you show above got to do with mandatory locking?
You completely missed the explicit locking calls that you have to make,
to get and release the locks.  If you don't make the call, and you have
madatory locking, then your process will sleep until someone else
releases the lock; if you only have advisory locking, and you use the
miscreant code you show, then indeed things will go awry.


---------------------------+-----------------------------------------------
Chuck Robey                | Interests include any kind of voice or data 
chu...@picnic.mat.net      | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1 |
Greenbelt, MD 20770        | picnic.mat.net: FreeBSD/i386
(301) 220-2114             | jaunt.mat.net : FreeBSD/Alpha
---------------------------+-----------------------------------------------



To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to