lock1 is an intrinsic object type, where objects can
be created using lock1.new() or by embedding.
lock1 objects are locked by threads, either as an
exclusive lock or a shared lock. This object is used to control access to
a resource (an object referenced via a variable) that may be shared by
more than one thread concurrently.
The value of an object of type lock1 is undefined and it is an error to attempt to get or to set it.
A lock created using lock1.new() can be
pre-locked. This lock is exclusive and anonymous
in the sense that no thread holds the lock, but any thread can release
it. The return value is a reference to the new object. Embedded
lock1 objects are created without a lock.
| Property | Type | Description |
|---|---|---|
| _ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. |
| __ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property. |
| type | type | Specifies the lock1 type object. |
The lock will be acquired if no other thread has any lock on this
object and there is no anonymous lock on it. A thread can have any
number of exclusive locks on each lock1 object,
but a single exclusive lock by one thread prevents any sort of lock
by any other thread. A thread can have both exclusive and shared
locks at the same time. If no lock can be acquired immediately and
the value of the block parameter is
.true then the thread will not continue until the
lock can be acquired. If the lock can never be acquired because one
or more other locks are held by threads that cannot release them then
the program halts with the error number 73: deadly embrace. The
return value is .true or
.false, indicating whether or not the lock was
acquired.
The lock will be acquired if no other thread has an exclusive lock
on this object and there is no anonymous lock on it. A thread can
have any number of shared locks on each lock1
object, and any number of threads can also hold shared locks on the
same object at the same time, but a single exclusive lock by one
thread prevents any shared lock by any other thread. A thread can
have both exclusive and shared locks at the same time. If no lock can
be acquired immediately and the value of the block
parameter is .true then the thread will not
continue until the lock can be acquired. If the lock can never be
acquired because one or more exclusive locks are held by threads that
cannot release them then the program halts with the error number 73:
deadly embrace. The return value is .true or
.false, indicating whether or not the lock was
acquired.



