Snap for 5175981 from 2eacd483279af9c2296d7aea99594ce3425d5d7d to pie-vts-release

Change-Id: I752c80ab3d20d7ae7944589b534b07753f9598b4
diff --git a/net/test/anycast_test.py b/net/test/anycast_test.py
index 82130db..62d874e 100755
--- a/net/test/anycast_test.py
+++ b/net/test/anycast_test.py
@@ -93,7 +93,9 @@
     # This will hang if the kernel has the bug.
     thread = CloseFileDescriptorThread(self.tuns[netid])
     thread.start()
-    time.sleep(0.1)
+    # Wait up to 0.5 seconds for the thread to finish, but
+    # continue and fail the test if the thread hangs.
+    thread.join(0.5)
 
     # Make teardown work.
     del self.tuns[netid]