def threadfunc(callback):
 callback = Async(callback)
 try:
  while True:
   print '!'
   callback()
   time.sleep(1)
 except:
  print 'thread exiting'

def threadfunc ( callback ) : callback = Async ( callback ) try : while True : print '!' callback ( ) time . sleep ( 1 ) except : print 'thread exiting'
this function will call the callback every second .