You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
401 B
Python
23 lines
401 B
Python
3 months ago
|
import time
|
||
|
|
||
|
|
||
|
def delay(us):
|
||
|
end_time = time.perf_counter_ns() + us * 1000
|
||
|
while time.perf_counter_ns() < end_time:
|
||
|
print("", end="")
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
import threading
|
||
|
|
||
|
def test():
|
||
|
time.sleep(1)
|
||
|
print("hello")
|
||
|
|
||
|
def test_2():
|
||
|
delay(1000 * 1000 * 10)
|
||
|
|
||
|
threading.Thread(target=test).start()
|
||
|
threading.Thread(target=test_2).start()
|
||
|
|