atomic mode for objc methods; doc tweaks
svn: r13022
This commit is contained in:
parent
9281b6f2b5
commit
090c73647f
|
@ -118,13 +118,13 @@ Defines each @scheme[class-id] to the class (a value with FFI type
|
|||
(eval:alts (import-class NSString) (void))
|
||||
]}
|
||||
|
||||
@defform/subs[#:literals (+ -)
|
||||
@defform/subs[#:literals (+ - +a -a)
|
||||
(define-objc-class class-id superclass-expr
|
||||
[field-id ...]
|
||||
method)
|
||||
([method (mode result-ctype-expr (method-id) body ...+)
|
||||
(mode result-ctype-expr (arg ...+) body ...+)]
|
||||
[mode + -]
|
||||
[mode + - +a -a]
|
||||
[arg (code:line method-id [ctype-expr arg-id])])]{
|
||||
|
||||
Defines @scheme[class-id] as a new, registered Objective-C class (of
|
||||
|
@ -138,10 +138,12 @@ directly when the method @scheme[body]s. Outside the object, they can
|
|||
be referenced and set with @scheme[get-ivar] and @scheme[set-ivar!].
|
||||
|
||||
Each @scheme[method] adds or overrides a method to the class (when
|
||||
@scheme[mode] is @scheme[-]) to be called on instances, or it adds a
|
||||
method to the meta-class (when @scheme[mode] is @scheme[+]) to be
|
||||
called on the class itself. All result and argument types must be
|
||||
declared using FFI C types (@seeCtype).
|
||||
@scheme[mode] is @scheme[-] or @scheme[-a]) to be called on instances,
|
||||
or it adds a method to the meta-class (when @scheme[mode] is
|
||||
@scheme[+] or @scheme[+a]) to be called on the class itself. All
|
||||
result and argument types must be declared using FFI C types
|
||||
(@seeCtype). When @scheme[mode] is @scheme[+a] or @scheme[-a], the
|
||||
method is called in atomic mode (see @scheme[_cprocedure]).
|
||||
|
||||
If a @scheme[method] is declared with a single @scheme[method-id] and
|
||||
no arguments, then @scheme[method-id] must not end with
|
||||
|
|
|
@ -364,7 +364,7 @@
|
|||
;; Given a dealloc extension:
|
||||
#'()
|
||||
;; Need to add one explicitly:
|
||||
#'((- _void (dealloc) (void)))))])
|
||||
#'((-a _void (dealloc) (void)))))])
|
||||
(syntax/loc stx
|
||||
(begin
|
||||
(define superclass-id superclass)
|
||||
|
@ -454,10 +454,13 @@
|
|||
(syntax-case #'m ()
|
||||
[(kind result-type (id arg ...) body0 body ...)
|
||||
(or (free-identifier=? #'kind #'+)
|
||||
(free-identifier=? #'kind #'-))
|
||||
(free-identifier=? #'kind #'-)
|
||||
(free-identifier=? #'kind #'+a)
|
||||
(free-identifier=? #'kind #'-a))
|
||||
(let ([id #'id]
|
||||
[args (syntax->list #'(arg ...))]
|
||||
[in-class? (free-identifier=? #'kind #'+)])
|
||||
[in-class? (or (free-identifier=? #'kind #'+)
|
||||
(free-identifier=? #'kind #'+a))])
|
||||
(when (null? args)
|
||||
(unless (identifier? id)
|
||||
(raise-syntax-error #f
|
||||
|
@ -485,7 +488,9 @@
|
|||
'())]
|
||||
[in-cls (if in-class?
|
||||
#'(object_getClass cls)
|
||||
#'cls)])
|
||||
#'cls)]
|
||||
[atomic? (or (free-identifier=? #'kind #'+a)
|
||||
(free-identifier=? #'kind #'-a))])
|
||||
(syntax/loc stx
|
||||
(let ([rt result-type]
|
||||
[arg-id arg-type] ...)
|
||||
|
@ -498,7 +503,7 @@
|
|||
[super-tell do-super-tell])
|
||||
body0 body ...
|
||||
dealloc-body ...)))
|
||||
(_fun _id _id arg-type ... -> rt)
|
||||
(_fun #:atomic? atomic? _id _id arg-type ... -> rt)
|
||||
(generate-layout rt (list arg-id ...)))))))))]
|
||||
[else (raise-syntax-error #f
|
||||
"bad method form"
|
||||
|
|
|
@ -334,7 +334,7 @@ this procedure type and called from foreign code, then the PLT Scheme
|
|||
process is put into atomic mode while evaluating the Scheme procedure
|
||||
body. In atomic mode, other Scheme threads do not run, so the Scheme
|
||||
code must not call any function that potentially synchronizes with
|
||||
other threads, otherwise it may deadlock. In addition, the Scheme code
|
||||
other threads, or else it may deadlock. In addition, the Scheme code
|
||||
must not perform any potentially blocking operation (such as I/O), it
|
||||
must not raise an uncaught exception, it must not perform any escaping
|
||||
continuation jumps, and its non-tail recursion must be minimal to
|
||||
|
|
|
@ -128,7 +128,9 @@ type. The property value must be a list of three procedures:
|
|||
@scheme[equal?] to ensure that data cycles are handled
|
||||
properly and to work with @scheme[equal?/recur] (but beware
|
||||
that an arbitrary function can be provided to
|
||||
@scheme[equal?/recur]).
|
||||
@scheme[equal?/recur] for recursive checks, which means that
|
||||
arguments provided to the predicate might be exposed to
|
||||
arbitrary code).
|
||||
|
||||
The @scheme[_equal-proc] is called for a pair of structures
|
||||
only when they are not @scheme[eq?], and only when they both
|
||||
|
|
Loading…
Reference in New Issue
Block a user