Archived:How to create a daemon process in PySymbian
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata
This code create a daemon process.
import appuifw
import e32
import thread
lock = e32.Ao_lock()
lockTHR = thread.allocate_lock()
###### replace this function with what you want to execute
i = 0
def funcDaemon():
global i
while(1):
lockTHR.acquire()
e32.ao_sleep(1)
open('E:\\Others\\tmp.txt', 'a').write(str(i)+"\n")
i+=1
lockTHR.release()
####################################################################
appuifw.app.title = u'DaemonS60'
appuifw.app.exit_key_handler = lambda:lock.signal()
print 'DaemonS60 - Start'
thread.start_new_thread(funcDaemon, ())
lock.wait()
print 'DaemonS60 - Stop'


(no comments yet)