Last active
September 2, 2016 02:56
-
-
Save Chrisplus/d6e93373fc9e62fb6f2a9fc3f05d4670 to your computer and use it in GitHub Desktop.
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 characters
| 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 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment