Wednesday, 24 July 2013

using time module with thread module

import thread; thread.start_new_thread( my_function, (args in a tuple structure).

Then inside my_function,time.sleep(x) to call the grist of the function at regular intervals from within a loop (e..g while true; or while count < x:).

Threads are sometimes called light-weight processes. They do not require as much memory overhead as a regular process.

No comments: