mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 13:01:42 -08:00
multiprocessing: create atomic structure slot accessors by default
Previously we were only creating atomic accessors when explicitely told so, which is problematic for compatibility reasons, since it requires compatibility libraries to define their own versions of defstruct just for ECL. This change is backwards compatible.
This commit is contained in:
parent
6ade6d4491
commit
12fedc5fe3
3 changed files with 11 additions and 10 deletions
|
|
@ -98,10 +98,12 @@ Currently, the following places are supported:
|
|||
@code{car}, @code{cdr}, @code{first}, @code{rest}, @code{svref},
|
||||
@code{symbol-plist}, @code{symbol-value}, @code{slot-value},
|
||||
@code{clos:standard-instance-access},
|
||||
@code{clos:funcallable-standard-instance-access}, a struct accessor
|
||||
defined by @code{defstruct} with the @code{:atomic-accessors} option
|
||||
enabled or any other place for which a compare-and-swap expansion was
|
||||
defined by @code{mp:defcas} or @code{mp:define-cas-expander}.
|
||||
@code{clos:funcallable-standard-instance-access}, a structure slot
|
||||
accessor@footnote{The creation of atomic structure slot accessors can be
|
||||
deactivated by supplying a @code{(:atomic-accessors nil)} option to
|
||||
@code{defstruct}.} or any other place for which a compare-and-swap
|
||||
expansion was defined by @code{mp:defcas} or
|
||||
@code{mp:define-cas-expander}.
|
||||
|
||||
For @code{slot-value}, @code{slot-unbound} is called if the slot is
|
||||
unbound unless @var{old} is @code{eq} to @code{si:unbound}, in which
|
||||
|
|
@ -129,7 +131,7 @@ Example:
|
|||
Atomic update of a structure slot. If the update would not be atomic,
|
||||
the result would be unpredictable.
|
||||
@lisp
|
||||
(defstruct (test-struct :atomic-accessors)
|
||||
(defstruct test-struct
|
||||
(slot1 0))
|
||||
(let ((struct (make-test-struct)))
|
||||
(mapc #'mp:process-join
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ as a STRUCTURE doc and can be retrieved by (documentation 'NAME 'structure)."
|
|||
print-function print-object type named initial-offset
|
||||
offset name-offset
|
||||
documentation
|
||||
atomic-accessors)
|
||||
(atomic-accessors t))
|
||||
|
||||
;; Parse the defstruct options.
|
||||
(do ((os options (cdr os)) (o) (v))
|
||||
|
|
@ -461,6 +461,7 @@ as a STRUCTURE doc and can be retrieved by (documentation 'NAME 'structure)."
|
|||
`(function ,v))))
|
||||
(:TYPE (setq type v))
|
||||
(:INITIAL-OFFSET (setq initial-offset v))
|
||||
(:ATOMIC-ACCESSORS (setq atomic-accessors v))
|
||||
(t (error "~S is an illegal defstruct option." o))))
|
||||
(t
|
||||
(if (consp (car os))
|
||||
|
|
@ -472,9 +473,8 @@ as a STRUCTURE doc and can be retrieved by (documentation 'NAME 'structure)."
|
|||
(cons default-constructor constructors)))
|
||||
(:CONC-NAME
|
||||
(setq conc-name nil))
|
||||
((:COPIER :PREDICATE :PRINT-FUNCTION :PRINT-OBJECT))
|
||||
((:COPIER :PREDICATE :PRINT-FUNCTION :PRINT-OBJECT :ATOMIC-ACCESSORS))
|
||||
(:NAMED (setq named t))
|
||||
(:ATOMIC-ACCESSORS (setq atomic-accessors t))
|
||||
(t (error "~S is an illegal defstruct option." o))))))
|
||||
|
||||
;; Skip the documentation string.
|
||||
|
|
|
|||
|
|
@ -270,8 +270,7 @@ Currently, the following places are supported:
|
|||
|
||||
car, cdr, first, rest, svref, symbol-plist, symbol-value, slot-value,
|
||||
clos:standard-instance-access, clos:funcallable-standard-instance-access,
|
||||
a struct accessor defined by defstruct with the :atomic-accessors
|
||||
option enabled or any other place for which a compare-and-swap
|
||||
a struct accessor or any other place for which a compare-and-swap
|
||||
expansion was defined by defcas or define-cas-expander.
|
||||
|
||||
For slot-value, slot-unbound is called if the slot is unbound unless
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue