Skip to content

Modern Fs FileLock Release

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Filesystem › Filesystem Library › FileLock.Release

FileLock.Release

Releases the lock; harmless when none is held.

Syntax

FileLock.Release( )

Examples

#import "std/fs"
using fs

dim td as FsResultUStr = CreateTempDir( "fbdoc" )
dim as ustring dir_ = td.Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
WriteAllText( p, "hello" )

dim lk as FileLock
lk.Acquire( p )

lk.Release( )
print lk.IsHeld( )           '' false

'' Releasing a lock that is not held is harmless, and the DESTRUCTOR
'' releases -- so a lock cannot outlive its scope even on an early exit
lk.Release( )
print lk.IsHeld( )           '' false

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Locking, Mapping And Watching

Clone this wiki locally