mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Add TODO in snippets.test_threading
This commit is contained in:
1 file changed
+9
-6
@@ -5,17 +5,20 @@ output = []
|
||||
|
||||
|
||||
def thread_function(name):
|
||||
output.append("Thread %s: starting" % name)
|
||||
output.append((name, 0))
|
||||
time.sleep(2.0)
|
||||
output.append("Thread %s: finishing" % name)
|
||||
output.append((name, 1))
|
||||
|
||||
|
||||
output.append("Main : before creating thread")
|
||||
output.append((0, 0))
|
||||
x = threading.Thread(target=thread_function, args=(1, ))
|
||||
output.append("Main : before running thread")
|
||||
output.append((0, 1))
|
||||
x.start()
|
||||
output.append("Main : wait for the thread to finish")
|
||||
output.append((0, 2))
|
||||
x.join()
|
||||
output.append("Main : all done")
|
||||
output.append((0, 3))
|
||||
|
||||
assert len(output) == 6, output
|
||||
# CPython has [(1, 0), (0, 2)] for the middle 2, but we have [(0, 2), (1, 0)]
|
||||
# TODO: maybe fix this, if it turns out to be a problem?
|
||||
# assert output == [(0, 0), (0, 1), (1, 0), (0, 2), (1, 1), (0, 3)]
|
||||
Reference in new issue
Block a user