×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    Thread management on 7650

    Hi,
    I have come across some really strange behaviour with threads on the 7650 (the phone, not the emulator).
    I have a game control thread, in a web-based game, that is constantly looping and checking to see if it needs to make any requests from the server. The http communication is also performed in this same thread (I'm trying to keep the communication serial, one request at a time, so I didn't see a need for a separate communication thread).
    The thing is, when it's not your turn to play, the game thread will poll the server for updates, and then sleep for a few seconds. When it is your turn to play, the thread loops constantly waiting for flags to be set by the UI to send the requests, without any delays (no Thread.sleep()).
    When I ran this on the emulator it worked perfectly, but as soon as I downloaded to the phone, I saw that when it is my turn to play (no sleeps in the thread), the phone would get completely stuck, and have no event handling.
    I managed to solve this by putting a Thread.yield(), command at the end of the loop. But shouldn't the threads be managed automatically by the VM?
    Has anyone experienced similar behaviour? Any solutions?
    By the way, this was tested on a 7650 with firmware version 3.16.

    Thanks.

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    just a bump

    I'm sorry to bump this up like this, but it has had so little views and I do beleive that this is an important subject.
    I would like to here from someone from Nokia about this.

    shmoove

Posting Permissions

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