Platinum Partner

Using Ao_sleep

In python for series 60, the use of e32.ao_sleep is encourage
over time.sleep. AO stands for 'Active Object' approach to
cooperative multi-tasking. When an object go to 'ao_sleep'
other active objects can run.

import e32
e32.ao_sleep(5)  # sleep for 5 seconds

There is another usage ao_sleep(interval, callback)
where ao_sleep will return immediately but the callback
will be called after the interval (in another thread?)

This could be used to create a repeat loop for every interval.
I show this in a previous snippet.

import e32, time

def showtime():
  print time.clock()
  e32.ao_sleep(1, showtime)  # sleep then call itself again

showtime()  # start the loop
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}