FileLock.java (isValid): locks are valid if the channel is open.

2004-11-11  Casey Marshall  <csm@gnu.org>

	* gnu/java/nio/FileLock.java (isValid): locks are valid if the
	channel is open.
	* gnu/java/nio/channels/natFileChannelPosix.cc (lock): use
	'F_RDLCK' for shared locks, 'F_WRLCK' for exclusive locks.

From-SVN: r90538
This commit is contained in:
Casey Marshall 2004-11-12 19:15:27 +00:00 committed by Bryce McKinlay
parent 556f03c4f0
commit 2941ddc40c
3 changed files with 9 additions and 2 deletions

View file

@ -72,7 +72,7 @@ public class FileLockImpl extends FileLock
public boolean isValid ()
{
return !channel().isOpen();
return channel().isOpen();
}
public synchronized void release () throws IOException

View file

@ -457,7 +457,7 @@ FileChannelImpl::lock
{
struct flock lockdata;
lockdata.l_type = shared ? F_WRLCK : F_RDLCK;
lockdata.l_type = shared ? F_RDLCK : F_WRLCK;
lockdata.l_whence = SEEK_SET;
lockdata.l_start = pos;
lockdata.l_len = len;