anycast_test.py: change to use thread.join to wait CloseFileDescriptorThread finished

The original implementation closes fd in a separate thread,
and the use time.sleep(0.1) to wait it finished, but there is the case that
on platforms like hikey the thread is not finished even after the slept 0.1s,

to make this test works for more platforms, we change to use thread.join(0.5) here
to wait up to 0.5 seconds.

And use thread.isActive to check if there is the hang problem.

Test: run vts-kernel -m VtsKernelNetTest with 4.9 and 4.14 kernel

There will be 1 or more failed in 5 iterations,
after this change all will pass in 10 iterations.

Change-Id: I24341667c9a889d79d38a9eb1d88d05325d7ffff
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
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]