historical/toontown-classic.git/toontown/toonbase/WaitAsync.py

23 lines
496 B
Python
Raw Normal View History

2024-01-16 17:20:27 +00:00
#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)