File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -324,11 +324,10 @@ void multiThreadedPageInBackground(const DeferredFiles &deferred) {
324324 << deferred.size () << " \n " ;
325325}
326326
327- static void
328- multiThreadedPageIn ( const DeferredFiles &deferred = DeferredFiles()) {
327+ static void multiThreadedPageIn ( const DeferredFiles &deferred) {
328+ static std::deque< DeferredFiles *> queue;
329329 static std::thread *running;
330330 static std::mutex mutex;
331- static std::deque<DeferredFiles *> queue;
332331
333332 mutex.lock ();
334333 if (running && (queue.empty () || deferred.empty ())) {
@@ -341,16 +340,18 @@ multiThreadedPageIn(const DeferredFiles &deferred = DeferredFiles()) {
341340 queue.emplace_back (new DeferredFiles (deferred));
342341 if (!running)
343342 running = new std::thread ([&]() {
344- mutex.lock ();
345- while (!queue.empty ()) {
343+ while (true ) {
344+ mutex.lock ();
345+ if (queue.empty ()) {
346+ mutex.unlock ();
347+ return ;
348+ }
346349 DeferredFiles *deferred = queue.front ();
350+ queue.pop_front ();
347351 mutex.unlock ();
348352 multiThreadedPageInBackground (*deferred);
349353 delete deferred;
350- mutex.lock ();
351- queue.pop_front ();
352354 }
353- mutex.unlock ();
354355 });
355356 }
356357 mutex.unlock ();
@@ -1413,8 +1414,8 @@ static void createFiles(const InputArgList &args) {
14131414 archive->addLazySymbols ();
14141415 }
14151416
1416- // reap threads
1417- // multiThreadedPageIn();
1417+ DeferredFiles reapThreads;
1418+ multiThreadedPageIn (reapThreads );
14181419 }
14191420}
14201421
You can’t perform that action at this time.
0 commit comments