Changeset 19001 in osm for applications/editors/josm/plugins/livegps/src
- Timestamp:
- 2009-12-09T00:02:55+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsSuppressor.java
r19000 r19001 21 21 * Default sleep time is 5 seconds. 22 22 */ 23 private static final int DEFAULT_SLEEP_TIME = 5 000;23 private static final int DEFAULT_SLEEP_TIME = 5; 24 24 25 25 /** … … 46 46 47 47 shutdownFlag = false; 48 while (!shutdownFlag) { 48 // stop the thread, when explicitely shut down or when disabled by 49 // config setting 50 while (!shutdownFlag && isEnabled()) { 49 51 setAllowUpdate(true); 50 52 … … 92 94 public synchronized boolean isAllowUpdate() { 93 95 94 if (allowUpdate) {95 allowUpdate = false;96 // if disabled, always permit a re-draw. 97 if (!isEnabled()) { 96 98 return true; 97 99 } else { 98 return false; 100 101 if (allowUpdate) { 102 allowUpdate = false; 103 return true; 104 } else { 105 return false; 106 } 99 107 } 108 } 109 110 /** 111 * A value below 1 disables this feature. 112 * This ensures that a small value does not run this thread 113 * in a tight loop. 114 * 115 * @return true, if suppressing is enabled 116 */ 117 private boolean isEnabled() { 118 return this.sleepTime > 0; 100 119 } 101 120
Note:
See TracChangeset
for help on using the changeset viewer.