2 ms·
>readily available and with a few lines of code 1. Declare the classes you want to work under transactional memory as transactional... by wrapping them in such
by flavio81 9y ago
>readily available and with a few lines of code
1. Declare the classes you want to work under transactional memory as transactional... by wrapping them in such a way:
(transactional (defclass ...))
2. Whenever you need to do a STM transaction, just wrap the critical code within (atomic):
(atomic (do-stuff ... ))
Is it hard? Nope. The above example is one easy way to do it in Common Lisp, using the STMX library, which of course you can download, compile and load with one line of code:
(ql:quickload "stmx")
So yes, it is easy under Clojure, but not only in Clojure.