Commits

Brian Kearns  committed 114c53c

try to fix this test from occasionally hanging untranslated

  • Participants
  • Parent commits 204b726
  • Branches stdlib-2.7.6

Comments (0)

Files changed (1)

File pypy/module/select/test/test_select.py

         return FileAsSocket(s1), FileAsSocket(s2)
 
     def test_poll_threaded(self):
-        import os, select, threading, time
+        import os, select, thread, time
         if not hasattr(select, 'poll'):
             skip("no select.poll() on this platform")
         r, w = os.pipe()
             for fd in rfds:
                 pollster.register(fd, select.POLLIN)
 
-            t = threading.Thread(target=pollster.poll)
-            t.start()
+            t = thread.start_new_thread(pollster.poll, ())
             try:
-                for i in range(5):
-                    time.sleep(0.1); print '',  # print to release GIL untranslated
+                time.sleep(0.1); print '',  # print to release GIL untranslated
                 # trigger ufds array reallocation
                 for fd in rfds:
                     pollster.unregister(fd)
             finally:
                 # and make the call to poll() from the thread return
                 os.write(w, b'spam')
-                t.join()
+                time.sleep(0.1); print '',  # print to release GIL untranslated
         finally:
             os.close(r)
             os.close(w)