From 23d46620f273e737d2f75063095749cb1978d5ad Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 3 May 2012 16:20:53 -0600 Subject: [PATCH] documentation tweaks --- collects/scribblings/reference/data.scrbl | 31 ++++++++++----------- collects/scribblings/reference/unsafe.scrbl | 2 +- doc/release-notes/racket/HISTORY.txt | 3 ++ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/collects/scribblings/reference/data.scrbl b/collects/scribblings/reference/data.scrbl index 0badc58557..3149d52ab3 100644 --- a/collects/scribblings/reference/data.scrbl +++ b/collects/scribblings/reference/data.scrbl @@ -112,31 +112,28 @@ Returns the content of @racket[box].} For any @racket[v], @racket[(unbox (box v))] returns @racket[v]. -@defproc[(set-box! [box (and/c box? (not/c immutable?))] +@defproc[(set-box! [box (and/c box? (not/c immutable?) (not/c impersonator?))] [v any/c]) void?]{ -Sets the content of @racket[box] to @racket[v]. +Sets the content of @racket[box] to @racket[v].} -@defproc[(box-cas! [loc box?] [old any/c] [new any/c]) boolean?]{ - Atomically updates the contents of @racket[loc] to @racket[new], provided - that @racket[loc] currently contains a value that is @racket[eq?] to - @racket[old]. When Racket is compiled with support for @tech{futures}, - this uses a hardware @emph{compare and set} operation. + +@defproc[(box-cas! [box box?] [old any/c] [new any/c]) boolean?]{ + Atomically updates the contents of @racket[box] to @racket[new], provided + that @racket[box] currently contains a value that is @racket[eq?] to + @racket[old], and returns @racket[#t] in that case. If @racket[box] + does not contain @racket[old], then the result is @racket[#f]. If no other @tech{threads} or @tech{futures} attempt to access - @racket[loc], this is equivalent to + @racket[box], the operation is equivalent to + @racketblock[ (and (eq? old (unbox loc)) (set-box! loc new) #t)] - - Uses of @racket[box-cas!] be performed safely in parallel with other - operations. In contrast, other atomic operations are not safe to perform in - parallel, and they therefore prevent a computation from continuing in - parallel. - If @racket[loc] is a @tech{chaperone} or @tech{impersonator} of a box, the - @exnraise[exn:fail:contract].} - -} + When Racket is compiled with support for @tech{futures}, + @racket[box-cas!] uses a hardware @emph{compare and set} operation. + Uses of @racket[box-cas!] be performed safely in a @tech{future} (i.e., + allowing the future thunk to continue in parallel). } @; ---------------------------------------------------------------------- @include-section["hashes.scrbl"] diff --git a/collects/scribblings/reference/unsafe.scrbl b/collects/scribblings/reference/unsafe.scrbl index 87df0298ea..f93857d919 100644 --- a/collects/scribblings/reference/unsafe.scrbl +++ b/collects/scribblings/reference/unsafe.scrbl @@ -215,7 +215,7 @@ Unsafe versions of @racket[unbox] and @racket[set-box!], where the @defproc[(unsafe-box*-cas! [loc box?] [old any/c] [new any/c]) boolean?]{ Unsafe version of @racket[box-cas!]. Like @racket[unsafe-set-box*!], it does - not work on impersonators. + not work on @tech{impersonators}. } @deftogether[( diff --git a/doc/release-notes/racket/HISTORY.txt b/doc/release-notes/racket/HISTORY.txt index e19f42190b..ac1094fb81 100644 --- a/doc/release-notes/racket/HISTORY.txt +++ b/doc/release-notes/racket/HISTORY.txt @@ -1,3 +1,6 @@ +Version 5.3.0.5 +Added box-cas! + Version 5.3.0.4 racket/draw: added make-color, make-brush, make-pen