throws an exception because a mutex that has not been entered cannot be released. However, if the commented-out line is enabled, no exception occurs and “true” is output.
Apparently, isSet/0 changes the state of the mutex. Yet the name suggests that the predicate is merely intended to query the state.
Yes, you are right our implementation of isSet (which is used for many other things than mutex'es) doesn't work for a mutex, because it will actually acquire the mutex.
There is no way to test ownership of a mutex, so I think we will implement the predicate to raise an exception for mutexes.