You Are Here:

Community: Developer Discussion Boards

#1 Old Appuifw and Threads... - 2008-09-22, 20:03

Join Date: Jan 2007
Posts: 80
nono240
Offline
Regular Contributor
Hi there !

I'm trying to write on a "Text" instance from a thread, but the interpreter crash ! Is there any such a limititations ?

Something like (pure example) :
Code:
def thread(text):
    text.add(u"Hello World from thread")

t = appuifw.Text()
appuifw.app.body = t 
t.add(u"Hello World") # Work
thread.start_new_thread(thread,(t,)) # Crash
...
What am I missing ?


In a world without Walls nor Windows, who need Gates ?
Reply With Quote

#2 Old Re: Appuifw and Threads... - 2008-09-22, 20:20

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Hi,

From the PyS60 documentation:
Quote:
It is possible to launch new threads via the services of thread module. Examples of such situations could
be to overcome eventual problems with the xed, relatively small stack size of the main UI application
thread; or to perform some background processing while still keeping the UI responsive. These new
threads are not allowed to directly manipulate the UI; in other words, they may not use the appuifw
module.
That seems to be true. I tried a non-appuifw thread:
Code:
import thread


def f(text):
    print "30"

thread.start_new_thread(f,tuple([None]))
and it worked.
Reply With Quote

#3 Old Re: Appuifw and Threads... - 2008-09-23, 08:02

Join Date: Jan 2007
Posts: 80
nono240
Offline
Regular Contributor
Ok, thanks for information, but my UI have multiple tabs : each contains a Text object which must be updated asynchronously from data received from sockets (like a chat program)... If threads can't handle appuifw, how to do that ???


In a world without Walls nor Windows, who need Gates ?
Reply With Quote

#4 Old Thumbs up Re: Appuifw and Threads... - 2008-09-23, 14:04

Join Date: Jan 2004
Posts: 368
Location: Helsinki
Send a message via Skype™ to miohtama
miohtama's Avatar
miohtama
Offline
Regular Contributor
Quote:
Originally Posted by nono240 View Post
Ok, thanks for information, but my UI have multiple tabs : each contains a Text object which must be updated asynchronously from data received from sockets (like a chat program)... If threads can't handle appuifw, how to do that ???
Series 60 UI is effectively single threaded. If you need to trigger UI events from worker thread you need to use e32.ao_callgate() function which delegates execution to UI thread. Also, your worker and UI threads need to proper ao_sleep() functions to give execution time to other threads.


Mikko Ohtamaa
Twinapex Research
http://www.twinapex.com
Reply With Quote

#5 Old Re: Appuifw and Threads... - 2008-09-23, 14:33

Join Date: Jan 2007
Posts: 80
nono240
Offline
Regular Contributor
It works ! Exactly what I searched for ! Thanks A LOT !


In a world without Walls nor Windows, who need Gates ?
Last edited by nono240 : 2008-09-23 at 14:39.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
ao_callgate and threads happyalu Python 2 2007-04-17 20:30
Threads and select kolbi-nokia Python 1 2007-02-01 17:21
Please, need help on threads lfd Python 6 2006-11-30 17:30
Cant get threads to work. RICH? Python 7 2006-11-22 16:43
Graphics and Threads nibss Python 0 2006-06-15 06:04

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia