Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User ecostanza's Avatar
    Join Date
    Jan 2007
    Posts
    29
    Hello.

    This code:

    Code:
    import thread
    import e32
    
    class Downloader(object):
        def __init__(self):
            self._completed = False
            
        def start(self):
            thread.start_new_thread(self.run, ())
            
        def run(self):
            # waste some time..
            for i in range(1000):j = i*i/10.0
            self._completed = True
    
        def completed(self):
            return self._completed
    
    d = Downloader()
    d.start()
    counter=0
    while d.completed() == False:
        print unicode(counter)
        counter+=1
        e32.ao_sleep(0.01)
    print u'done'
    produces the expected output, but if I turn on the "crash monitor" in DrJukka.com's y-tasks v 0.51 I get the following error message:
    "Py_{number}
    Terminate: 0", where {number} changes every time and seems to indicate the thread ID.
    (in the y-tasks detailed info it tells me "exit category: terminate, exit type: terminate")
    I tried this on an E51.

    Is this normal, or am I doing something wrong?
    Why is the thread termination handled in a way that is recognized by y-tasks as a crash? Is it an issue with my code, with y-tasks, or with pys60?

    Thanks,
    Enrico

  2. #2
    Regular Contributor GameDude's Avatar
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147
    Terminate: 0
    0 == KErrNone, which means it terminated ok.

    There is a line in thread_symbian.h:
    Code:
    RThread().Terminate(0);
    Which I believe is the reason why Y-tasks catches it. And this is a normal behavior. Nothing wrong happening. It seems that if there are problems, Python panics.

  3. #3
    Registered User ecostanza's Avatar
    Join Date
    Jan 2007
    Posts
    29
    Thanks for your reply!

    Quote Originally Posted by GameDude View Post

    There is a line in thread_symbian.h:
    Code:
    RThread().Terminate(0);
    I read in the RThread::Terminate() documentation:
    This function behaves in the same way as Kill()
    ...
    A thread can also end itself by calling User::Exit()
    I wonder if it would be possible to close the thread by using User::Exit() instead, and if that would be better -- from my point of view it is convenient to use a tool like ytasks to try and find out if there is anything going wrong in my app, but it's difficult to do it if I am inundated by "terminate" messages, so it is in this spirit that if these messages were removed it would be "better".

    It seems to me that RThread::Terminate() is called from the thread which is actually exiting (i.e. not from another thread).

    Thoughts?

    Best,
    Enrico

  4. #4
    Regular Contributor GameDude's Avatar
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147
    Well, I'm not sure why the Terminate is even called. If you check the RThread example code from Wiki, Terminate is not called. I believe thread would exit cleanly if Terminate was not called at all.

    I tested removing Terminate() on emulator and it didn't seem to cause any trouble.

Similar Threads

  1. S60 SDK 3rd edition FP1 Emulator problem
    By justteam in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2010-03-23, 08:47
  2. S60 5th Edition SDK, EMULATOR crashing
    By zoiks_guy in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2009-01-16, 05:37
  3. emulator startup failed
    By hony in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-11-11, 06:07
  4. 为什么会启动这么多的线程
    By shaojieli in forum Symbian
    Replies: 1
    Last Post: 2008-08-19, 05:34
  5. Link errors when trying to Display bitmap
    By Bkc82 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-01-16, 22:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved