historical/toontown-classic.git/toontown/toonbase/WaitAsync.py
2024-01-16 11:20:27 -06:00

23 lines
No EOL
496 B
Python

#Wait Async
#By Sparksammy
import thread
import time
def wait(time2wait):
timeEnd = time2wait + time.time()
timer = thread.allocate_lock()
with timer:
while True:
if time.time() >= timeEnd:
break
def waitAndExec(time2wait, execAfter):
timer = thread.allocate_lock()
currTime = 0
timeEnd = time2wait + time.time()
with timer:
while True:
if time.time() >= timeEnd:
break
exec(execAfter)