Skip to content

Commit

Permalink
Added incomplete getting-started text
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Feb 8, 2024
1 parent bd1277f commit 290ee8c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion doc/basics.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
TBC
### Creating a new Mutex

A new mutex, an instance of type `Mutex[ValueType]` for some choice of
`ValueTyp`, can be constructed by supplying its initial value to the `Mutex`
factory method, like so:
```scala
val count: Mutex[Int] = Mutex(32)
```

This represents a mutex variable, which is set to `32`. Any thread which has a
reference to `count` may read or modify this variable, but only in delimited
blocks.

We can read the value only through a lambda applied to the `read` method of
`Mutex`, which provides a reference for accessing the value.

0 comments on commit 290ee8c

Please sign in to comment.