Jump to content

quick question about sleep


imNew
 Share

Recommended Posts

2 question:

1 if sleep(1000) is called in the middle of sleep(10000) @ the 5 th second what will happen?

total sleep of (6000)

or total sleep of (11000)?

2 sleep() can not prevent interrupt being fired and handled. thus in my "Pause()" func, I need to disable all the hotkeys except for the hotkey for "Resume()' right?

Link to comment
Share on other sites

thanks for replying but I don't think I understood

let me rephrase:

1) if sleep(1000) is called in the middle of sleep(10000) @ the 5 th second what will happen?

total pause time of 6 secs? (the sleep(1000) has terminated sleep(10000))

total pause time of 11 secs? (the sleep(1000) paused the execution of sleep(10000))

2) sleep() can not prevent interrupt being fired and handled. thus in my "Pause()" func, I need to disable all the hotkeys except for the hotkey for "Resume()' right?

Link to comment
Share on other sites

ok, let me provide some context:

while 1; GUI while

sleep(1000)

wend

key pressed and interrupt routine is called

func Interrupt_handling_routine_being_called()

sleep(100)

;do stuff

endfunc

so it's possible that sleep(100) is called in the middle of that sleep(1000) right?

Link to comment
Share on other sites

Hmmm.... this is kinda wierd... Anyways, I wrote a timer script you can play around with to test some theories with the Sleep function.

HotKeySet("{Ins}", "Interrupt")
AdlibEnable("TimeCalc", 5)
$Timer = TimerInit()

Sleep(10000)

Func Interrupt()
    Sleep(5000)
EndFunc

Func TimeCalc()
    $Diff = Round(TimerDiff($Timer)/1000, 2)
    TrayTip("Time", $Diff, 5)
EndFunc

Feel free to play around with it, and see what results you can come up with.

- Dan [Website]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...