Quite a regular
Joined: 2006/11/27 22:17 Last Login
: 2019/11/28 9:17
From Israel
Group:
Registered Users
|
Hi all,
I have this issue with python on AOS4:
I try to add thread that does a loop, but the programs doesn't continues unless the thread is killed (ctrl-c). The same code on linux does that it should (enters the loop, "appended ..." message is printed. main program sleeps 10 seconds, quit=1->thread dies...)
Any ideas? The code(replace "!" with spaces, indentation is crucial in python):
#!/usr/bin/python import sys import time import threading import os
def mloop(): !!while not quit: !!!!print "loop" !!!!print time.time() !!!!os.system("sleep 2") !!!!print time.time() !!print "exiting thread"
quit=0 t = threading.Thread(target=mloop) t.start() print "appended mloop" os.system('sleep 10') quit=1 os.system('sleep 2')
|