public void acquire() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. while (true) { try { if (acquire(Long.MAX_VALUE)) return; } catch (InterruptedException e) { //ignore and loop } } }
public void acquire() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. boolean interrupted = false; while (true) { try { if (acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { interrupted = true; } } //preserve thread interrupt state if (interrupted) Thread.currentThread().interrupt(); }
@Override public void acquire() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. boolean interrupted = false; while (true) { try { if (acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { interrupted = true; } } //preserve thread interrupt state if (interrupted) Thread.currentThread().interrupt(); }
@Override public void acquire() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. boolean interrupted = false; while (true) { try { if (acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { interrupted = true; } } //preserve thread interrupt state if (interrupted) Thread.currentThread().interrupt(); }
/** * Re-acquires a suspended lock and reverts to the correct lock depth. */ public void resume() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. while (true) { try { if (lock.acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { //ignore and loop } } lock.setDepth(depth); } }
/** * Re-acquires a suspended lock and reverts to the correct lock depth. */ public void resume() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. while (true) { try { if (lock.acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { //ignore and loop } } lock.setDepth(depth); } }
/** * Re-acquires a suspended lock and reverts to the correct lock depth. */ public void resume() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. while (true) { try { if (lock.acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { //ignore and loop } } lock.setDepth(depth); } }
/** * Re-acquires a suspended lock and reverts to the correct lock depth. */ public void resume() { //spin until the lock is successfully acquired //NOTE: spinning here allows the UI thread to service pending syncExecs //if the UI thread is waiting to acquire a lock. while (true) { try { if (lock.acquire(Long.MAX_VALUE)) break; } catch (InterruptedException e) { //ignore and loop } } lock.setDepth(depth); } }