You're viewing version 1.2.0 of sync. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (sync flags-ignored-for-now & body)
transaction-flags => TBD, pass nil for now

Runs the exprs (in an implicit do) in a transaction that encompasses
exprs and any nested calls. Starts a transaction if none is already
running on this thread. Any uncaught exception will abort the
transaction and flow out of sync. The exprs may be run more than
once, but any effects on Refs will be atomic.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:1906 top

(defmacro sync
  "transaction-flags => TBD, pass nil for now

  Runs the exprs (in an implicit do) in a transaction that encompasses
  exprs and any nested calls.  Starts a transaction if none is already
  running on this thread. Any uncaught exception will abort the
  transaction and flow out of sync. The exprs may be run more than
  once, but any effects on Refs will be atomic."
  {:added "1.0"}
  [flags-ignored-for-now & body]
  `(. clojure.lang.LockingTransaction
      (runInTransaction (fn [] ~@body))))
Vars in clojure.core/sync: defmacro apply concat fn list seq vector
Used in 1 other vars dosync

Comments top

1 comment(s) for sync.

Same as dosync but allows for extra options (which are not currently supported). Probably best to use dosync instead at the moment.

Log in to add a comment.