'''
Created on Jul 31, 2014

@author: bailey
'''

import time
from threading import Thread

THREADS = 3


def main():
    manager = ThreadManager()
    manager.start(THREADS)
    
    
class ThreadManager:
    def __init__(self):
       pass
        
    def start(self, threads):
        thread_refs = []
        for i in range(threads):
            t = MyThread(i)
            t.daemon = True
            print('starting thread %i' % i)
            t.start()
        ##for t in thread_refs:
            ##t.join()
            
            
class MyThread(Thread):
    def __init__(self, i):
        Thread.__init__(self)
        self.i = i
        self.stopping = 25
        
    def run(self):
        if self.stopping > 0:
            print(str(self.stopping) + ' =  stage number ... hello from thread # ' + str(self.i))
            self.stopping -= 1
            print("About to doze off")
            time.sleep(2)
            print("I slept")
            time.sleep(3)
            print("Did I snore???")


if __name__ == '__main__':
    main()