Ref Type: Ref

Overview

A ref is a reference type which is shared, asynchronous, and coordinated:

  • shared - multiple threads can share access

  • asynchronous - changes may not occur immediately

  • coordinated - changes can be made to multiple items

Example: Move $20 from this account to that account, right now.

Refs allow coordinated modification of multiple storage locations, by means of a software transactional memory (STM) system.

Clojure API

Note: "CC" links to the official Clojure documentation; "CD" links to ClojureDocs.

  • alter (CC, CD) - sets the in-transaction-value of a Ref

  • commute (CC, CD) - sets the in-transaction-value of a Ref

  • ensure (CC, CD) - protects the Ref from other transactions

  • ref (CC, CD) - creates and returns a Ref

  • ref-set (CC, CD) - sets the value of a Ref

To be continued...


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r7 - 21 Aug 2015, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email