'타이머'에 해당되는 글 2건

  1. 2013.12.18 [Python] 연습코딩, thread, timer, input, try
  2. 2013.12.12 [objc] 일정시간후 block 실행


import threading, time


def hello():

        i = 0

        while i < 5:

                i = i + 1

                print("hello "+str(i))

                time.sleep(1.0)



inp = input("input time? ")

try:

        numInp = int(inp)

        print("input value : " + inp)

except ValueError:

        print("input value is not valid. \n default : 1")

        numInp = 1.0

t = threading.Timer(numInp, hello)

t.start()





Posted by tenn
,




dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
    ...
});




http://stackoverflow.com/questions/4139219/how-do-you-trigger-a-block-after-a-delay-like-performselectorwithobjectafter

Posted by tenn
,