Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //class Derp would be initiated in another class and on a sperate thread and getTime()
- //would be periodically accesed to reset the time value back to 0
- public class Derp{
- private AtomicLong time = new AtomicLong(0);
- //somewhere here time is modified
- public AtomicLong getTime(){
- return time;
- }
- }
- //Could I use the following to bypass the need for the atomic part
- public class Derp {
- private long time = 0;
- //somewhere here time is modified
- public void resetTime() {
- time - 0;
- }
- }
- //only resetTime would be called the exact value of time would never be needed
- //Since the Derp class would be on a seperate thread then the class resetting the
- //time would I run into any problems?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement