store/[org.clojure/clojure "1.8.0"] clj::clojure.core/io!

Official Documentation

Add notes
Arities
==================================================
   [& body]

Docstring
==================================================
  If an io! block occurs in a transaction, throws an
  IllegalStateException, else runs body in an implicit do. If the
  first expression in body is a literal string, will use that as the
  exception message.

Source

(defmacro io!
  "If an io! block occurs in a transaction, throws an
  IllegalStateException, else runs body in an implicit do. If the
  first expression in body is a literal string, will use that as the
  exception message."
  {:added "1.0"}
  [& body]
  (let [message (when (string? (first body)) (first body))
        body (if message (next body) body)]
    `(if (clojure.lang.LockingTransaction/isRunning)
       (throw (new IllegalStateException ~(or message "I/O in transaction")))
       (do ~@body))))

Example 1

Edit
(def a (ref 0))
;; => #'user/a

(dosync
 (io! (println "hello"))
 (alter a inc))
;; => IllegalStateException I/O in transaction

(dosync
 (println "hello")
 (alter a inc))
;; > "hello"
;; => 1

(defn fn-with-io []
  (io! (println "hello")))
;; => #'user/fn-with-io

(dosync
 (fn-with-io)
 (alter a inc))
;; => IllegalStateException I/O in transaction

Uses on crossclj