---
title: sharedLock
framework: system
role: symbol
role_heading: Type Property
path: system/filedescriptor/openoptions/sharedlock
---

# sharedLock

Indicates that opening the file atomically obtains a shared lock on the file.

## Declaration

```swift
static var sharedLock: FileDescriptor.OpenOptions { get }
```

## Mentioned in

Adopting Swift File Options

## Discussion

Discussion Setting this option or the exclusiveLock option obtains a lock with flock(2) semantics. If you’re creating a file using the create option, the request for the lock always succeeds except on file systems that don’t support locking. The corresponding C constant is O_SHLOCK.

## See Also

### Specifying Options

- [append](system/filedescriptor/openoptions/append.md)
- [closeOnExec](system/filedescriptor/openoptions/closeonexec.md)
- [create](system/filedescriptor/openoptions/create.md)
- [eventOnly](system/filedescriptor/openoptions/eventonly.md)
- [exclusiveCreate](system/filedescriptor/openoptions/exclusivecreate.md)
- [exclusiveLock](system/filedescriptor/openoptions/exclusivelock.md)
- [noFollow](system/filedescriptor/openoptions/nofollow.md)
- [nonBlocking](system/filedescriptor/openoptions/nonblocking.md)
- [symlink](system/filedescriptor/openoptions/symlink.md)
- [truncate](system/filedescriptor/openoptions/truncate.md)
