filecontentloading thread waits for participating indexing threads to finish

This commit is contained in:
Maxim.Mossienko
2013-07-05 15:44:19 +02:00
parent 33cdb24cd1
commit f109537642
@@ -69,6 +69,9 @@ public class FileContentQueue {
file = myFilesToLoadQueue.poll();
}
synchronized (myProceedWithProcessingLock) {
while (myBytesBeingProcessed > 0) myProceedWithProcessingLock.wait();
}
// put end-of-queue marker only if not canceled
try {
myLoadedContentsQueue.put(new FileContent(null));
@@ -248,7 +251,7 @@ public class FileContentQueue {
synchronized (myProceedWithLoadingLock) {
myLoadedBytesInQueue -= result.getLength();
myProceedWithLoadingLock.notify(); // we ask only content loading thread to proceed, TODO: fix if more than one loading thread
myProceedWithLoadingLock.notifyAll(); // we actually ask only content loading thread to proceed, so there should not be much difference with plain notify
}
return result;