You Are Here:

Community: Developer Discussion Boards

#1 Old Any change in thread module in the version 1.9.2 ?? - 2009-03-12, 11:18

Join Date: Mar 2009
Posts: 7
thoronnim
Offline
Registered User
Hi all,

I didn't read anything in the release notes about possible changes in the thread module.. but all the thread I made, worked so well in version 1.4.5 e now, with the version 1.9.2, when I run the same codes, nothing happens.. this simple code does nothing too!
Code:
import thread


def speriamo(self):
    num=0
    while (1):
        num=num+1
        print num
    return


def main():
    thread.start_new_thread(speriamo, (None,))
    print(u"Ciao") 
    return

main()
I'm using a N95 8Gb and my final goal is to create a thread that has to send information over bluetooth; all the bluetooth code works really good, but when I put it in a thread.. it doesn't work anymore!!

please, help me..

thank you! Emanuele
Reply With Quote

#2 Old Re: Any change in thread module in the version 1.9.2 ?? - 2009-03-12, 12:41

Join Date: Nov 2007
Posts: 319
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Quote:
Originally Posted by thoronnim View Post
Hi all,

I didn't read anything in the release notes about possible changes in the thread module.. but all the thread I made, worked so well in version 1.4.5 e now, with the version 1.9.2, when I run the same codes, nothing happens..
To be honest, I never used this thread module in 1.4.5. But, 1.9.2 comes with threading module, very simple to use.
Below, two ways to create threads using threading module (with and without classes).

Code:
import threading

class Task(threading.Thread):
    def __init__(self,arg):
        threading.Thread.__init__(self)
        self.arg = arg
    def run(self):
        for n in range(3):
            print self.arg

def tsk(arg1,arg2,arg3):
    # put a better thread body here
    for n in range(3):
        print arg1,arg2,arg3

t1 = threading.Thread(target=tsk,args=(1,"a",55))
t1.start()

t2 = Task("hello")
t2.start()

t1.join()
t2.join()
And you may use Queue modules as well, really nice to exchange messages between threads.


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
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
emulator startup failed hony Symbian User Interface 3 2008-11-11 07:07
S60 SDK 3rd edition FP1 Emulator problem justteam Symbian Tools & SDKs 12 2008-03-04 05:44
Change title of a forum thread? christoffer.haglund General Discussion 1 2007-08-15 17:57
nokia 7210 modem via IR doesn't work ! oussamaaiadi PC Suite API and PC Connectivity SDK 1 2003-03-06 11:46
Questions about version code in MMS protocol wangzhong General Messaging 1 2002-11-21 11:32

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