×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Aug 2003
    Location
    Eire
    Posts
    182

    Threads :: A very tight loop will cause sluggish responce from keypresses?

    I have converted an S60 version game to S40 and they code is the same (MIDP1) for handling input but the responce is very sluggish!

    Is this because there is some problem with the threads? I've 1 main game loop thread that handles everything and is the problem that this thread is being greedy and not giving the keypress thread any time?

    If so what is the solution???

    Setting the threads priority to the lowest so that keys will all be processed?
    or a .yeild() (do nokias even handle that well?)

    sleep would probably be the worst case! maybe sleep(5); would do it?

    Anybody any experience with this?

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    I have a feeling these phones ignore the thread's priority - whenever I tried toying around with those values I never got anything.
    A yield() would probably do, or a short sleep(), that's just about the same (a sleep() call first yields, so if the time is very short they have the same effect).

    shmoove

  3. #3
    Regular Contributor
    Join Date
    Aug 2003
    Location
    Eire
    Posts
    182
    Thanks Shmoove!

    Will go with the sleep(1);

    Its a pity we have to use workarounds!

    EDIT
    I tired both a yeild() and a sleep(6) and they've made very little difference. Is there anything else that could be tried?
    EDIT



    Also do s30 have bigger heaps or the same size as S40?

    I'm thinking they are similar but the small screen sizes leaves makes you use smaller images maybe leaving more heap space!

    Anyways a bit off-topic!
    Last edited by Woody_FX; 2004-07-19 at 13:24.

Posting Permissions

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