---
title: "SCPreferencesLock(_:_:)"
framework: systemconfiguration
role: symbol
role_heading: Function
path: "systemconfiguration/scpreferenceslock(_:_:)"
---

# SCPreferencesLock(_:_:)

Locks access to the configuration preferences.

## Declaration

```swift
func SCPreferencesLock(_ prefs: SCPreferences, _ wait: Bool) -> Bool
```

## Parameters

- `prefs`: The preferences session.
- `wait`: A Boolean value indicating whether the calling process should block, waiting for another process to complete its update operation and release its lock.

## Return Value

Return Value TRUE if the lock was obtained; FALSE if an error occurred.

## Discussion

Discussion This function obtains exclusive access to the configuration preferences. Clients attempting to obtain exclusive access to the preferences either receive a kSCStatusPrefsBusy error or they block, waiting for the lock to be released.

## See Also

### Managing Access to a Preferences Session

- [SCPreferencesUnlock(_:)](systemconfiguration/scpreferencesunlock(_:).md)
