Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:13, 23 August 2007.

KIJ000082 - Thread usage

From Forum Nokia Wiki


Platform: S60 2nd Edition Device: Nokia 6600

Description:

If a MIDlet is running any threads when exiting, the running threads may keep on hanging, thus reserving memory even after the MIDlet has exited.

Solution:

Before exiting an application with the Exit command or in some other graceful exit situation, all of the threads have to be killed. This can be done either in the destroyApp() method or in some other user-specified method that is called before exiting the MIDlet, for example, something like the following:

public void commandAction(Command c, Displayable d) {

    if (c == exitCommand) {

      // exit the MIDlet

      iRunning = false;

    }

  }

public void run()

  {

    while( iRunning )

    {

      repaint();

      serviceRepaints();

      try{ Thread.sleep(100); }catch( InterruptedException e ){}

    }

    MidletMain.quitApp();

  }

Related Discussions
Thread Thread Starter Forum Replies Last Post
ImageConvertion 1 crash adinkesp General Symbian C++ 9 2008-01-29 13:32
How can I get the image info without decoding simply? nanara General Symbian C++ 8 2007-05-26 10:30
How to destroy a thread? bitsonic Mobile Java General 2 2003-04-09 12:05
Why won't you die!? mtg101 General Symbian C++ 8 2005-09-08 18:31
Game loop and frames per second RonnieDeRakker Mobile Java Media (Graphics & Sounds) 4 2004-11-17 12:08
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZKnowledgeBaseContentQ
     qfnZtypeQUqfnTypeZKnownIssueQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX