diff options
author | David Morrissey <davemorrissey@gmail.com> | 2017-11-24 12:49:49 +0000 |
---|---|---|
committer | David Morrissey <davemorrissey@gmail.com> | 2017-11-24 12:49:49 +0000 |
commit | 504362d8a26226fa2cbfebe7cb6a348e6e475c41 (patch) | |
tree | 51023a279a8fa989921016e9429bfac9a26ae5f3 /library/src/main/java/com/davemorrissey/labs | |
parent | 6bb6ea7b1723db9fec0642a1391c848a0e5882c6 (diff) | |
download | subsampling-scale-image-view-504362d8a26226fa2cbfebe7cb6a348e6e475c41.tar.gz |
Simpler synchronization to prevent isReady call during recycling
Diffstat (limited to 'library/src/main/java/com/davemorrissey/labs')
-rw-r--r-- | library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java index 7338453..abf88b4 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java @@ -272,13 +272,8 @@ public class SkiaPooledImageRegionDecoder implements ImageRegionDecoder { * true if the pool has at least one decoder available. */ @Override - public boolean isReady() { - decoderLock.readLock().lock(); - try { - return decoderPool != null && !decoderPool.isEmpty(); - } finally { - decoderLock.readLock().unlock(); - } + public synchronized boolean isReady() { + return decoderPool != null && !decoderPool.isEmpty(); } /** @@ -286,7 +281,7 @@ public class SkiaPooledImageRegionDecoder implements ImageRegionDecoder { * and destroy the pool. Elsewhere, when a read lock is acquired, we must check the pool is not null. */ @Override - public void recycle() { + public synchronized void recycle() { decoderLock.writeLock().lock(); try { if (decoderPool != null) { |