Skip to content

Commit 400dba8

Browse files
committed
tests/select_poll_eintr.py: Wait thread done.
This tries to fix below issue by waiting thread done: `NameError: name 'time' isn't defined` Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
1 parent 81cf760 commit 400dba8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/extmod/select_poll_eintr.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ def thread_main():
3131
# Could possibly use _thread._interrupt_main() instead if MicroPython had it.
3232
gc.collect()
3333
print("thread gc end")
34+
global done
35+
done = True
3436

3537

3638
# Start a thread to interrupt the main thread during its call to poll.
39+
done = False
3740
lock = _thread.allocate_lock()
3841
lock.acquire()
3942
_thread.start_new_thread(thread_main, ())
@@ -54,5 +57,9 @@ def thread_main():
5457
else:
5558
print("dt not in range:", dt_ms)
5659

60+
# Wait thread done
61+
while not done:
62+
time.sleep(0.1)
63+
5764
# Clean up.
5865
s.close()

0 commit comments

Comments
 (0)