Re: Continue application processing with mouse down on a menu
Re: Continue application processing with mouse down on a menu
- Subject: Re: Continue application processing with mouse down on a menu
- From: Programmingkid <email@hidden>
- Date: Sat, 26 Sep 2015 14:19:09 -0400
On Sep 26, 2015, at 2:03 PM, Jens Alfke wrote:
>
>> On Sep 26, 2015, at 10:51 AM, Programmingkid <email@hidden> wrote:
>>
>> When I click on a menu, the application pauses. That seems pretty much like a smoking gun that things haven't changed much with the Mac OS.
>
> “The application pauses” is a pretty vague statement. If you’ve got a periodic task on the main runloop, driven by an NSTimer or a delayed-perform, then just make sure to specify that it runs in NSEventTrackingRunloopMode, as Eric said. The default runloop mode doesn’t get time during this kind of event tracking, to avoid problems like alerts popping up while you’re dragging a slider or selecting text.
I just wish there were an easy way for the a task on the main thread to continue to work even if the user is looking at a menu. Using multiple threads has a lot of problems associated with it.
>
> Things with the OS have actually changed a great deal. Believe me, I was there during the transition. The way the ‘classic’ OS worked was entirely different — there was no threading to speak of, and pulling down a menu literally put the _entire OS_ into a tight loop where it waited for the mouse to move and drew menus. The app couldn’t handle events or get any time at all; in fact no running app could do anything at all.
>
> (Yes, there were interrupt-level tasks, and later on the “Thread Manager” which allowed pre-emptive threads. But the set of things you could do from there was extremely limited: pure computation and — if you were very, very careful — limited file I/O or networking. You couldn’t even use regular malloc/free on a background task, because almost nothing in the OS was thread-safe. IT WAS HELL. It was a toy operating system compared to anything that exists today, except for maybe Arduinos.)
I remember those days well. Good bye WaitNextEvent()!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden