wait 0 with messages

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

wait 0 with messages

Post by makeshyft » Thu Aug 07, 2014 4:35 am

Hi Livecoders,

Can someone please help me understand why I have to use "wait 0 with messages" to stop the engine from locking up the UI? when doing a tight repeat loop....... even when I lock the screen it still ends up " non responsive" until the handler finishes. I just don't get why the engine is ahead of itself....lol

My goal is to understand this engine inside and out.

Thanks ahead of time.
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: wait 0 with messages

Post by FourthWorld » Thu Aug 07, 2014 5:46 am

This was a Mac-specific anomaly due to some of the interactions between LiveCode and Cocoa. This has been fixed for v6.7 and 7.0, both available for testing now.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: wait 0 with messages

Post by makeshyft » Thu Aug 07, 2014 6:22 pm

Excellent.......I have to process a lot of things in tight loops, so I am always running into using this, and using it without knowing why i am using it makes me crazy. Thanks Richard.

Will check out those builds and see if indeed it still happens.

Cheers
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: wait 0 with messages

Post by makeshyft » Sat Aug 09, 2014 7:13 pm

I am actually on Windows 7 , and I just tested 6.7 dp8 and it still locks up the UI in a tight loop.
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: wait 0 with messages

Post by FourthWorld » Sat Aug 09, 2014 8:35 pm

Hmmmm...it might be a bug, or it might be a performance optimization in which LC is just running too fast for Windows' redraw mechanism to keep up with.

But in the latter case, where performance is critical it's probably better to just lock screen/update UI/unlock screen to show the update/lock screen again anyway, so maybe this should be filed as a bug report to see how the engine team explains it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: wait 0 with messages

Post by makeshyft » Sat Aug 09, 2014 9:05 pm

Now that I think about it ..... That is how it was explained before, having to do with exactly what you said the redraw mechanism..... I do lock my screen, but it still displays "not responding" in the window..... I will file this ..... because maybe it would be easy to add a routine that prevents this from happening. "wait 0 with messages" adds a lot of milliseconds ..... and I am running through 100,000 user arrays.

I do LOVE the idea of the engine doing something TOO FAST...lol. Thanks Richard.
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: wait 0 with messages

Post by FourthWorld » Sat Aug 09, 2014 9:25 pm

makeshyft wrote:Now that I think about it ..... That is how it was explained before, having to do with exactly what you said the redraw mechanism..... I do lock my screen, but it still displays "not responding" in the window..... I will file this ....
Ah, wait a minute - "not responding" might be related to simple redraw actions, but normally we'd expect to see that with applications that have died, or for some reason aren't polling the OS frequently enough for events.

Still sounds like a bug, but possibly unrelated to redraw. Can you describe what the code is doing when you get that error notification?

Please keep us posted with what the team says. If you don't mind, it would be helpful if you could post the report number here after you submit it so interested members can follow the progress on this issue.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: wait 0 with messages

Post by makeshyft » Sun Aug 10, 2014 12:39 am

Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: wait 0 with messages

Post by [-hh] » Sun Aug 10, 2014 11:23 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 4:19 pm, edited 1 time in total.
shiftLock happens

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: wait 0 with messages

Post by dunbarx » Sun Aug 10, 2014 2:28 pm

Hermann.

Can you explain what you mean? I read: "wait 0 with messages" to be equivalent to: "wait 0 ticks with messages"

The default keyword being "ticks".

How does the explicit inclusion of "milliseconds" matter, if one is waiting for "0" of them. In other words, if one is not really waiting, does it matter for how long? Does one of those "keywords" actually transpire? Because at least one would have to, in order to make a difference.

Craig
Last edited by dunbarx on Sun Aug 10, 2014 4:12 pm, edited 1 time in total.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: wait 0 with messages

Post by [-hh] » Sun Aug 10, 2014 3:41 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 4:19 pm, edited 1 time in total.
shiftLock happens

makeshyft
Posts: 220
Joined: Mon Apr 15, 2013 4:41 am
Contact:

Re: wait 0 with messages

Post by makeshyft » Sun Aug 10, 2014 5:54 pm

its a feature that the windows process locks up during tight loops? the bug report was not about the merits of waiting 0 but rather a non responsive window.

...... waiting 0 with messages does add time to how long a handle takes, so for whatever reason its not really waiting 0.

I use milliseconds to count. I find it accurate enough for anything I need at this point timing wise.

Cheers dudes
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: wait 0 with messages

Post by dunbarx » Sun Aug 10, 2014 6:35 pm

waiting 0 with messages does add time to how long a handle takes, so for whatever reason its not really waiting 0.
For sure. The line of code itself has to be executed, after all, and that is enough to solve a world of issues. I was wondering if it mattered how long you did not wait, a tick or a mS.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: wait 0 with messages

Post by FourthWorld » Sun Aug 10, 2014 6:43 pm

"wait 0 with messages" adds time to long tasks because it's surrendering time to the OS and internal event loops. Whether you wait "0 milliseconds" or "0 seconds" it's still 0, which is to say it immediately gives a slice of CPU time over to the event loops.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: wait 0 with messages

Post by [-hh] » Sun Aug 10, 2014 9:43 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 4:19 pm, edited 1 time in total.
shiftLock happens

Post Reply

Return to “Talking LiveCode”