Articron Posted March 4, 2015 Share Posted March 4, 2015 (edited) The way a conditional sleep functions is amongst these lines : public boolean conditionalSleep(Condition c, long timeout) { Timer t = new Timer(timeout); while ((t.isRunning()) && (!c.validate())) { sleep(20); } c.validate(); return c.validate(); } Condition being following interface: public interface Condition { public boolean validate(); } Excuse the shit indentation :p Edited March 4, 2015 by Articron 1 Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 5, 2015 Share Posted March 5, 2015 The way a conditional sleep functions is amongst these lines : public boolean conditionalSleep(Condition c, long timeout) { Timer t = new Timer(timeout); while ((t.isRunning()) && (!c.validate())) { sleep(20); } c.validate(); return c.validate(); } Condition being following interface: public interface Condition { public boolean validate(); } Excuse the shit indentation nice to see you back 1 Quote Link to comment Share on other sites More sharing options...
Tom Posted March 5, 2015 Share Posted March 5, 2015 The world needs more people like you James, people that aren't afraid to express their opinions, and certainly don't treat everything like they are competing for the world title. Quote Link to comment Share on other sites More sharing options...
Articron Posted March 5, 2015 Share Posted March 5, 2015 nice to see you back Just a driveby post man, just a driveby 1 Quote Link to comment Share on other sites More sharing options...
VladBots Posted March 5, 2015 Share Posted March 5, 2015 c.validate(); return c.validate(); nice but da wut 1 Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 5, 2015 Share Posted March 5, 2015 nice but da wut brain fart Quote Link to comment Share on other sites More sharing options...