Domanda

Seems that the two concepts require the same set of methods (namely, lock, unlock, and try_lock). Does Mutex require that these methods support stronger semantics than Lockable?

È stato utile?

Soluzione

According to §30.4.1.2/2:

The mutex types shall meet the Lockable requirements (30.2.5.3).

§30.4.1.2/3, however, adds:

The mutex types shall be DefaultConstructible and Destructible. If initialization of an object of a mutex type fails, an exception of type system_error shall be thrown. The mutex types shall not be copyable or movable.

§30.4.1.2/3 adds another requirement, specifying precise error codes to be used by mutex types.

Bottom line: a mutex is Lockable, but adds a few more specific restrictions as well.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top