Beispiel #1
0
 /**
  * Recycles an unused heavy-weight lock. Locks are deallocated to processor specific lists, so
  * normally no synchronization is required to obtain or release a lock.
  */
 protected static void free(Lock l) {
   l.active = false;
   RVMThread me = RVMThread.getCurrentThread();
   if (me.cachedFreeLock == null) {
     if (trace) {
       VM.sysWriteln(
           "Lock.free: setting ",
           Magic.objectAsAddress(l),
           " as the cached free lock for Thread #",
           me.getThreadSlot());
     }
     me.cachedFreeLock = l;
   } else {
     if (trace) {
       VM.sysWriteln(
           "Lock.free: returning ",
           Magic.objectAsAddress(l),
           " to the global freelist for Thread #",
           me.getThreadSlot());
     }
     returnLock(l);
   }
 }