* GeoIP: Reduce thread priority during lookup

This commit is contained in:
zzz
2011-12-17 13:55:45 +00:00
parent 1488cd0f48
commit bf45e31c62

View File

@ -98,9 +98,17 @@ class GeoIP {
_pendingSearch.clear(); _pendingSearch.clear();
return; return;
} }
LookupJob j = new LookupJob(); int pri = Thread.currentThread().getPriority();
j.run(); if (pri > Thread.MIN_PRIORITY)
updateOurCountry(); Thread.currentThread().setPriority(pri - 1);
try {
LookupJob j = new LookupJob();
j.run();
updateOurCountry();
} finally {
if (pri > Thread.MIN_PRIORITY)
Thread.currentThread().setPriority(pri);
}
} }
private class LookupJob implements Runnable { private class LookupJob implements Runnable {