@Speel
I guess this is a little off topic... but I'm good at that :-)
Lock as in mutex? I guess - one thread can use the object at a time, forcing others to wait their turn. First come, first serve.
The Lock class is just an auxilliary that calls the locking (semaphore based on the AmigaOS version) methods for the Lockable derived class. But to answer your question, in the example I posted it ensures that the thread calling that particular method has a totally exclusive lock on the resource (in this case, the specific instance of the MyClass object, whatever that may be).
There are other Lock auxiliaries, such as LockReadOnly, which gets a shared lock. They use the specific "wait for a lock" methods of the Lockable class, so if the object is in use by another thread, the calling thread waits.
Lockable also supports "attempted" locks, where if the object is busy you don't get it and you dont wait either. To implement auxiliaries for these I saw no real way but to use an exception, thrown on construction of the auxiliary. The problem there is that I am trying like hell to avoid using exceptions in my layer due to quality of implementation / thread-safetu problems regarding exceptions in general.
Of course, you can manually call the Lockable inherited methods yourself. These Lock / LockReadOnly are merely convenience tools ;-) They have next to no overhead since each one simply encapsulates a Lockable* pointer that is passed on construction.
I basically wanted to give something a bit like the synchronized qualification in Java, but of course you can't exactly do that in C++. So these little "declare and forget" auxilliary classes work well for making these method calls behave that way.
The whole mechanism on AmigaOS simply wraps the SignalSemaphore. And it works a charm.