File size: 694 Bytes
43203b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(cl:in-package :cl-flow)


;;;
;;; ATOMICALLY
;;;
(defun dispatch-atomically (context fu invariant
                            &rest opts &key &allow-other-keys)
  (apply #'dispatch context fu invariant opts))


(defmacro atomically (invariant &body args)
  "Encloses atomic flow block of code that can be dispatched
concurrently. Non-consing."
  (destructuring-bind (opts lambda-list body) (parse-atomic-block-args args)
    (flow-lambda-macro (flow-context)
      (with-flow-function-macro (body-fu lambda-list body)
        `(dispatch-atomically ,flow-context #',body-fu ,invariant ,@opts)))))


(defmacro -> (invariant &body args)
  "See flow:atomically"
  `(atomically ,invariant ,@args))