Mail Archives: djgpp/1999/04/07/14:06:23
Tanes Sriviroolchai wrote:
>
> Eli Zaretskii wrote in message ...
> >
> >
> >> second of all, if you lock a file and another instance tries to write to
> >> it, what happens? how can you see if a file or region is locked?
> >
> >On DOS/Windows or on Unix?
> >
> >On Unix, the other process which tries to write blocks until the file
> >is unlocked. On DOS/Windows I think the write call fails, but you'll
> >need to try to make sure.
>
> It should be "On Unix, the other process which tried to write without test
> lock before will be successful. However, if that process test lock
> (with blocked) before write it will be blocked until that file is unlocked.
> Or it will be failed if that process test lock without block."
Confusion between cooperative (`flock') and mandatory (`fcntl',
sometimes) locking. Cooperative locking means that the process *should*
acquire the lock before writing, but isn't stopped if it doesn't.
Mandatory means that attempts to access a locked area are blocked; not
all systems implement this.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -