[Android] Thumbnailer: use break with label

Thomas Guillem git at videolan.org
Wed Sep 9 11:07:37 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Sep  9 10:42:52 2015 +0200| [5f5e245aac9c1899dbe696e85254dd8cf65e341f] | committer: Thomas Guillem

Thumbnailer: use break with label

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5f5e245aac9c1899dbe696e85254dd8cf65e341f
---

 vlc-android/src/org/videolan/vlc/Thumbnailer.java |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Thumbnailer.java b/vlc-android/src/org/videolan/vlc/Thumbnailer.java
index cdbf759..5f10781 100644
--- a/vlc-android/src/org/videolan/vlc/Thumbnailer.java
+++ b/vlc-android/src/org/videolan/vlc/Thumbnailer.java
@@ -130,13 +130,12 @@ public class Thumbnailer implements Runnable {
         int total = 0;
 
         Log.d(TAG, "Thumbnailer started");
-
+mainloop:
         while (!isStopping) {
             if (mVideoBrowser != null && mVideoBrowser.get() != null)
                 mVideoBrowser.get().resetBarrier();
             lock.lock();
             // Get the id of the file browser item to create its thumbnail.
-            boolean interrupted = false;
             while (mItems.size() == 0) {
                 try {
                     if (mVideoBrowser != null && mVideoBrowser.get() != null) {
@@ -146,15 +145,11 @@ public class Thumbnailer implements Runnable {
                     mTotalCount = 0;
                     notEmpty.await();
                 } catch (InterruptedException e) {
-                    interrupted = true;
                     Log.i(TAG, "interruption probably requested by stop()");
-                    break;
+                    lock.unlock();
+                    break mainloop;
                 }
             }
-            if (interrupted) {
-                lock.unlock();
-                break;
-            }
             total = mTotalCount;
             MediaWrapper item = mItems.poll();
             lock.unlock();



More information about the Android mailing list