devserver: generalize lock dictionary; substitute multiprocessing for threading

* Migrate the lock dictionary functionality into a dedicated class, so
  it can be easily used with other sets of resources.

* Replace multiprocessing primitives (processes, locks) with threading
  equivalents. There's no apparent reason for using multiprocessing, and
  threading primitives are expected to be faster/lighter.

BUG=None
TEST=Passes unit tests

Change-Id: I7e3671a55d17f6bc60217b278ccc7b69c72c6c48
Reviewed-on: https://gerrit.chromium.org/gerrit/33641
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
diff --git a/downloader_unittest.py b/downloader_unittest.py
index 0a4e4ed..07261d8 100755
--- a/downloader_unittest.py
+++ b/downloader_unittest.py
@@ -36,8 +36,7 @@
         'gs://chromeos-image-archive/x86-mario-release/' + self.build)
 
   def tearDown(self):
-    if os.path.exists(self._work_dir):
-      shutil.rmtree(self._work_dir)
+    shutil.rmtree(self._work_dir, ignore_errors=True)
 
   def _CommonDownloaderSetup(self, ignore_background=False):
     """Common code to downloader tests.