private void blockMe ( int cyclesToBlock ) { long unblock = cycles + cyclesToBlock ; BlockedEntry newEntry = new BlockedEntry ( unblock ) ; blockedCollection . add ( newEntry ) ; while ( unblock > cycles ) { try { newEntry . getSync ( ) . acquire ( ) ; // blocks } catch ( InterruptedException exc ) { log . error ( "[temporaryBlock] Spurious wakeup" , exc ) ; } } }
Blocks the calling thread until enough turns have elapsed