imNew Posted December 13, 2006 Share Posted December 13, 2006 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 More sharing options...
Richard Robertson Posted December 13, 2006 Share Posted December 13, 2006 Sleep applies to each thread realistically. AutoIt does not support real multithreading. It will run two pieces of code alternating I guess, but not at the same time. You could always try the double sleeps. It should cause no harm. Link to comment Share on other sites More sharing options...
imNew Posted December 13, 2006 Author Share Posted December 13, 2006 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 More sharing options...
Valuater Posted December 13, 2006 Share Posted December 13, 2006 1) if sleep(1000) is called in the middle of sleep(10000)can't be done8) Link to comment Share on other sites More sharing options...
imNew Posted December 14, 2006 Author Share Posted December 14, 2006 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 More sharing options...
Valuater Posted December 14, 2006 Share Posted December 14, 2006 You are 80% there.... just finish that script above with a timer and see 8) Link to comment Share on other sites More sharing options...
dandymcgee Posted December 14, 2006 Share Posted December 14, 2006 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 More sharing options...
imNew Posted December 14, 2006 Author Share Posted December 14, 2006 WOW, thanks a lot, the code definitely helped, that AdlibEnable function, which I never knew existed is a MAJOR helper=), I was going to ask how to handle exceptions, but that adlibenable opens up so many options Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now