×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    20

    How to get the State of a thread

    In midp2.0, Thread.getState() is not usable. Then is there an alternative way to get the state of a thread? like blocked,live or dead.
    Thanks

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: How to get the State of a thread

    Hello Zhang Jianliang,

    based on: http://developers.sun.com/mobility/m...es/threading2/

    "J2ME provides two variants of the Thread class, both subsets of the J2SE version 1.3. CLDC's Thread class includes only these methods:

    activeCount()
    currentThread()
    getPriority()
    isAlive()
    join()
    run()
    setPriority()
    sleep()
    start()
    yield()
    ..
    Your code can obtain access to the current thread's instance of Thread at any time by invoking Thread.currentThread().
    ..
    Once one thread has "asked" another thread to stop, the first thread can see whether the second is still alive by calling its isAlive() method. "

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    20

    Re: How to get the State of a thread

    Hello r2j7:
    "isAlive" includes two states: blocked and running.
    Then how can i judge whether a thread is blocked in socket communication situation.
    Thanks

  4. #4
    Registered User
    Join Date
    Jan 2008
    Location
    Pune
    Posts
    24

    Re: How to get the State of a thread

    Hi Zhang Jianliang,
    In case if u r using notify(); on running thread then isAlive() will return false on this Thread object.
    But its bit difficult to judge whether a thread is blocked in socket communication even I am also trying to find the solution.

    All best
    Anjan

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. console app running problem
    By xcompass in forum Symbian
    Replies: 3
    Last Post: 2009-05-08, 13:26
  3. Carbide C++ : ..... .pkg does not exist. Skipping...
    By satishkatta in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 144
    Last Post: 2008-08-07, 11:16
  4. Need Help with thread
    By gigglie in forum Symbian
    Replies: 0
    Last Post: 2008-06-20, 06:39
  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
  •  
×