Author Topic: SLEEP not working on the iPhone  (Read 1408 times)

Offline Millerszone

  • Dr. Type
  • ****
  • Posts: 307
  • www.smashedfly.com
    • View Profile
    • Smashed Fly
SLEEP not working on the iPhone
« on: 2011-Mar-03 »
SLEEP doesn't seem to be working on the iPhone.

Tried SLEEP 500, SLEEP 1000, SLEEP 5000

Using version GLBasic version 9.026
Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Offline msx

  • Prof. Inline
  • *****
  • Posts: 773
    • View Profile
Re: SLEEP not working on the iPhone
« Reply #1 on: 2011-Mar-03 »
You try this.

Code: (glbasic) [Select]
FUNCTION Pause%: delay%
  LOCAL time_start% = GETTIMERALL()
  WHILE ABS(GETTIMERALL() - time_start) < delay
    FOR i=1 TO 1000; NEXT
  WEND
ENDFUNCTION
« Last Edit: 2011-Mar-03 by msx »

Offline Marmor

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 926
  • 96A285CC
    • View Profile
    • my youtube channel
Re: SLEEP not working on the iPhone
« Reply #2 on: 2011-Mar-03 »
this will work but not really help msx because sleep give power to the os . or ?

Offline Moebius

  • Dr. Type
  • ****
  • Posts: 315
    • View Profile
Re: SLEEP not working on the iPhone
« Reply #3 on: 2011-Mar-04 »
Quote
this will work but not really help msx because sleep give power to the os . or ?

That's true, but when SLEEP isn't working your only choice is to loop.

I recall something like this being posted before:

Code: (glbasic) [Select]
FUNCTION Pause%: delay%
  LOCAL time_start% = GETTIMERALL()
  SLEEP delay%
  WHILE GETTIMERALL() - time_start < delay
  WEND
ENDFUNCTION

That way, if SLEEP works you save processor time, otherwise it just waits anyway.  Someone made a thread on this a while ago...
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary