Compare filelock lock types
mainChoose a lock type based on your filesystem capabilities and synchronization requirements:
| Lock Type | Key Features | Best Use Case |
|---|---|---|
| FileLock | Native backend support, cancellable acquire, self-deadlock detection. | Recommended default for most applications. |
| SoftFileLock | Cooperative file-existence marker; no native API required. | Shared filesystems where you can verify semantics. |
| StrictSoftFileLock | Fail-closed; removes claims by unique name; manual recovery. | Filesystems with coherent directory reads and atomic hard links. |
| SoftFileLease | Expiring claim with a heartbeat; on_compromise callback. | When progress matters more than strict exclusion (overlap acceptable). |
| ReadWriteLock | SQLite-backed; concurrent readers + one writer; reentrant. | Scenarios requiring multiple readers or async support via AsyncReadWriteLock. |
| SoftReadWriteLock | Reader/writer marker lease; heartbeat-based expiry; writer preference. | Tested shared filesystems requiring reader/writer semantics. |
| AsyncFileLock | Async/await support for all lock types via thread pools. | Integration into asynchronous event loops. |