Live data from Hacker News

If you move your mouse continually the query may not fail. Do not stop moving

support.microsoft.com

1–10 of 168 posts

Re: If you move your mouse continually the query may not fail. Do not stop moving

#5
I had this bug once about 10ish years ago when I was still a windows dev. Creating a 2nd window on a thread with a window already but then pumping it's main loop on a background thread can cause this. If you do that the loops get hooked to each other regardless of the thread pumping it. The child window has to wait until the parent window forwards the event for the second thread to pop it off. A mouse move will send a WM event and keep the child windows loop on the other thread spinning. My WM_TIMER on the child window was stuck as well.

It happened to me because I had a hidden window on the background thread to get WM events for USB disconnect and reconnect messages from the system. The bug report was funny. "Connecting USB data collection probe doesn't work unless the user moves the mouse after connecting." and the follow up bug "Data collection only works when moving the mouse."

Re: If you move your mouse continually the query may not fail. Do not stop moving

#6
post #3

Method4: just turn off the screensaver/standby?

Seems it's more about incorrect implementation of an event loop rather than a change in active processes. I assume the purpose of the screensaver is to save the screen, not to sleep other processes when it is activated. I further assume that hardware interrupts and event creation are the things happening while moving the mouse continuously. Based on these assumptions, I'm almost certain the screensaver isn't the problem.

Re: If you move your mouse continually the query may not fail. Do not stop moving

#8
This reminds me a bit of how networking works on OS X and iOS (at least if you are using the "standard APIs" the way they are supposed to be used: The networking that is going on is tied to a runloop. Some apps tie the networking stuff to the main run loop. You can see which apps do that by simply opening a context menu in the app somewhere or open a regular menu from the app's main menu. The run loops will be "halted" for as long the menu is open and thus your networking will stop. As soon you dismiss the menu the networking will continue.

At first this may seem totally bullshitty: Imagine a download manager. Do you really want the download to pause every time you open a context menu? Well it turns out it is not such a bad idea in many cases: What if the context menu allows you to cancel the download? If the download were to go on in the background you would have to explicitly take care of that. If you tie the networking callbacks to your main runloop this simply can't happen.

Of course there are also a lot of use cases where you want your networking code to not have anything to do with your main runloop...

Re: If you move your mouse continually the query may not fail. Do not stop moving

#10

This reminds me a bit of how networking works on OS X and iOS (at least if you are using the "standard APIs" the way they are supposed to be used: The networking that is going on is tied to a runloop. Some apps tie the networking stuff to the main run loop. You can see which apps do that by simply opening a context menu in the app somewhere or open a regular menu from the app's main menu. The run loops will be "halte…

This isn't really correct. Runloops have modes. Often networking happens in a mode that is not restricted (see NSRunLoopCommonModes here https://developer.apple.com/library/ios/documentation/cocoa/... ).

If you are running your network code in default mode on the main thread (problematic doing that and it's probably better to use async methods these days) then yes that can happen but it's usually programmer error.

On Mac, entering a modal window will usually put the runloop in a context that regular events won't fire and only those that mater to the modal window will fire. Commons mode almost always fires though.

I work on Apportable (YC2011) and we have reimplemented CFRunLoop/NSRunLoop down to the bare metal. A lot of misconceptions on how it works we find.

Post reply on HN