Last active
September 2, 2016 02:56
-
-
Save Chrisplus/d6e93373fc9e62fb6f2a9fc3f05d4670 to your computer and use it in GitHub Desktop.
Revisions
-
Chrisplus created this gist
Sep 2, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ public class PTimer extends Thread{ private int waitTime; private int seq = 0; private SWE swe = null; public PTimer(int time, int s, SWE c) { waitTime = time; seq = s; swe = c; } public void run() { try { sleep(waitTime); } catch (InterruptedException e) {} swe.generate_timeout_event(seq); } } //To start a timer PTimer timer = new PTimer(....) // set the params timer.start() //To stop a timer if(timer != null){ timer.stop }