Previous: Package Lock Concepts, Up: Package Locks

### 11.2 Package Lock Dictionary

— Declaration: sb-ext:disable-package-locks

> Syntax: `(sb-ext:disable-package-locks symbol*)`

> Disables package locks affecting the named symbols during compilation in the lexical scope of the declaration. Disabling locks on symbols whose home package is unlocked, or disabling an already disabled lock, has no effect.

— Declaration: sb-ext:enable-package-locks

> Syntax: `(sb-ext:enable-package-locks symbol*)`

> Re-enables package locks affecting the named symbols during compilation in the lexical scope of the declaration. Enabling locks that were not first disabled with `sb-ext:disable-package-locks` declaration, or enabling locks that are already enabled has no effect.

— Condition: sb-ext:package-lock-violation

> Class precedence list: `package-lock-violation, package-error, error, serious-condition, condition, t`

> Subtype of `cl:package-error`. A subtype of this error is signalled when a package-lock is violated.

— Condition: sb-ext:package-locked-error

> Class precedence list: `package-locked-error, package-lock-violation, package-error, error, serious-condition, condition, t`

> Subtype of `sb-ext:package-lock-violation`. An error of this type is signalled when an operation on a package violates a package lock.

— Condition: sb-ext:symbol-package-locked-error

> Class precedence list: `symbol-package-locked-error, package-lock-violation, package-error, error, serious-condition, condition, t`

> Subtype of `sb-ext:package-lock-violation`. An error of this type is signalled when an operation on a symbol violates a package lock. The symbol that caused the violation is accessed by the function `sb-ext:package-locked-error-symbol`.

— Function: sb-ext:package-locked-error-symbol symbol-package-locked-error

> Returns the symbol that caused the `symbol-package-locked-error` condition.

— Function: sb-ext:package-locked-p package

> Returns `t` when `package` is locked, `nil` otherwise. Signals an error if `package` doesn't designate a valid package.

— Function: sb-ext:lock-package package

> Locks `package` and returns `t`. Has no effect if `package` was already locked. Signals an error if `package` is not a valid package designator

— Function: sb-ext:unlock-package package

> Unlocks `package` and returns `t`. Has no effect if `package` was already unlocked. Signals an error if `package` is not a valid package designator.

— Function: sb-ext:package-implemented-by-list package

> Returns a list containing the implementation packages of `package`. Signals an error if `package` is not a valid package designator.

— Function: sb-ext:package-implements-list package

> Returns the packages that `package` is an implementation package of. Signals an error if `package` is not a valid package designator.

— Function: sb-ext:add-implementation-package packages-to-add &optional package

> Adds `packages-to-add` as implementation packages of `package`. Signals an error if `package` or any of the `packages-to-add` is not a valid package designator.

— Function: sb-ext:remove-implementation-package packages-to-remove &optional package

> Removes `packages-to-remove` from the implementation packages of `package`. Signals an error if `package` or any of the `packages-to-remove` is not a valid package designator.

— Macro: sb-ext:without-package-locks &body body

> Ignores all runtime package lock violations during the execution of body. Body can begin with declarations.

— Macro: sb-ext:with-unlocked-packages (&rest packages) &body forms

> Unlocks `packages` for the dynamic scope of the body. Signals an error if any of `packages` is not a valid package designator.

— Macro: defpackage name [[option]]* => package

> Options are extended to include the following:

> - `:lock` boolean

>   If the argument to `:lock` is `t`, the package is initially locked. If `:lock` is not provided it defaults to `nil`.

> - `:implement` package-designator*

>   The package is added as an implementation package to the packages named. If `:implement` is not provided, it defaults to the package itself.

> Example:

>               (defpackage "FOO" (:export "BAR") (:lock t) (:implement))
>               (defpackage "FOO-INT" (:use "FOO") (:implement "FOO" "FOO-INT"))

>               ;;; is equivalent to

>               (defpackage "FOO") (:export "BAR"))
>               (lock-package "FOO")
>               (remove-implementation-package "FOO" "FOO")
>               (defpackage "FOO-INT" (:use "BAR"))
>               (add-implementation-package "FOO-INT" "FOO")