Skip to content

Instantly share code, notes, and snippets.

@rainyman2012
Last active September 3, 2021 10:26
Show Gist options
  • Save rainyman2012/cd1f1b2c45be81a935af91aec1a992a9 to your computer and use it in GitHub Desktop.
Save rainyman2012/cd1f1b2c45be81a935af91aec1a992a9 to your computer and use it in GitHub Desktop.
import threading
import time
def blocking_io():
print("thread start")
time.sleep(10)
print("thread finished")
def main():
t1 = threading.Thread(target=blocking_io, name="blocking_task")
t1.start()
t1.join()
start_time = time.perf_counter()
main()
print("process exited")
end_time = time.perf_counter()
execution_time = end_time - start_time
print(f"\nExecuting - {__file__}\nExecution Starts: {start_time}\nExecutions Ends: {end_time}\nTotals Execution Time:{execution_time:0.2f} seconds.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment