Title:

threadLock.assign - method for assign() for threadLock objects. This is a mutually exclusive assignment in that no other thread can be assigning to this object at the same time.

Usage:

threadLock.assign(threadlock, name, value, broadcast = F )

Arguments:

threadlock:
the threadLock: object into which this object will be assigned.
name:
the name of the object to which to assign value:
value:
the value to be assigned to the name name in the threadlock object.
broadcast:
if this is T, all threads waiting on this variable in a condition in getLock are woken and compete for the lock. If false, only one of the waiting threads is woken, but which is unknown a priori.

NOTE:

If this function immediately attempts to acquire the relevant lock before evaluating the value argument, that argument can contain interesting things. Namely, it can access the variables within the threadLock object knowing that these are locked. So this is convenient shorthand for enclosing a call to this function (threadLock.assign()) within a
         getLock(x)
          threadLock.assign(x,...)
         yieldLock(x)
       
and may eradicate the problem of checking of the same thread attempting to get the same lock recursively as would happen in the above code snippet if (threadLock.assign()) also attempts to acquire the lock.

Side Effect:

This function call waits until it acquires the lock associated with threadlock. Then it assigns the value to the threadLock object using name as the identifier and releases the lock. Finally it broadcasts an to threads waiting on this variable in a call to getLock using the condition argument.

See Also:

threadLock.get()

Examples:


Key Words:

User Level Threads

Last modified: Thu Feb 6 11:48:12 1997