chickadee » srfi-216 » test-and-set!

test-and-set! cellprocedure

Tests the cell and returns the result of the test. In addition, if the test was false, test-and-set! sets the cell contents to true before returning false.

The test-and-set! operation must be performed atomically. That is, the implementation must guarantee that, once a process has tested the cell and found it to be false, the cell contents will actually be set to true before any other process can test the cell. See Section 3.4.2, Subsection "Implementing Serializers".