some fixes for testing in event queue
This commit is contained in:
		| @@ -52,7 +52,7 @@ public class Audio { | |||||||
|   /** |   /** | ||||||
|    * This method stops the Update Method's thread.  |    * This method stops the Update Method's thread.  | ||||||
|    */ |    */ | ||||||
|   public static void stopService() { |   public static synchronized void stopService() { | ||||||
|     if (updateThread != null) { |     if (updateThread != null) { | ||||||
|       updateThread.interrupt(); |       updateThread.interrupt(); | ||||||
|     } |     } | ||||||
| @@ -62,11 +62,12 @@ public class Audio { | |||||||
|    * This method stops the Update Method's thread.  |    * This method stops the Update Method's thread.  | ||||||
|    * @return boolean |    * @return boolean | ||||||
|    */ |    */ | ||||||
|   public static boolean isServiceRunning() { |   public static synchronized boolean isServiceRunning() { | ||||||
|     if (updateThread != null) { |     if (updateThread != null && updateThread.isAlive() ) { | ||||||
|       return updateThread.isAlive(); |       return true; | ||||||
|  |     } else { | ||||||
|  |       return false; | ||||||
|     } |     } | ||||||
|     return false; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
| @@ -83,6 +84,13 @@ public class Audio { | |||||||
|         } |         } | ||||||
|       }); |       }); | ||||||
|     } |     } | ||||||
|  |     startThread(); | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   /** | ||||||
|  |    * This is a synchronized thread starter | ||||||
|  |    */ | ||||||
|  |   public static synchronized void startThread() { | ||||||
|     if (!updateThread.isAlive()) { |     if (!updateThread.isAlive()) { | ||||||
|       updateThread.start(); |       updateThread.start(); | ||||||
|       headIndex = 0; |       headIndex = 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user