if (busyflag == Thread.currentThread()) { busyflag = null; }
while (busyflag != Thread.currentThread()) { if (busyflag == null) busyflag = Thread.currentThread(); try { Thread.sleep(100); } catch (Exception e) {} }