1. /*
  2. * @(#)SyncUtil.java 1.3 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.orbutil.concurrent;
  8. import com.sun.corba.se.impl.orbutil.concurrent.Sync ;
  9. public class SyncUtil {
  10. private SyncUtil() {}
  11. /** Method to acquire a Sync without ever throwing an
  12. * InterruptedException. Useful when a mutex is being
  13. * used in place of Java synchronization.
  14. */
  15. public static void acquire( Sync sync )
  16. {
  17. boolean held = false ;
  18. while (!held) {
  19. try {
  20. sync.acquire() ;
  21. held = true ;
  22. } catch (InterruptedException exc) {
  23. held = false ;
  24. }
  25. }
  26. }
  27. }