Re: Need some advice on multithreading
Re: Need some advice on multithreading
- Subject: Re: Need some advice on multithreading
- From: WT <email@hidden>
- Date: Mon, 24 Nov 2008 23:21:43 +0100
That's exactly what I had done in the first place, but the results
weren't too good. I then wrote a much simpler app (one bouncing
ball) to test possible solutions and, of course, started with this
very approach. For fun, I allow the user to rotate the container
and, sure enough, the ball hangs in mid-air while I'm rotating the
view. And this, of course, happens regardless of how slow the steps
are because the problem is really that the simulation, the drawing,
and all the event handling all happen in the same thread (the main
thread), so when I'm playing with the slider, the simulation is not
running.
NSTimers are scheduled in particular run-loop modes. Tracking of a
mouse drag on a control runs in a special mode,
NSEventTrackingRunLoopMode. If you schedule your timer to run in
that mode, too, it will keep running while tracking is going on.
Excellent! That solves one of my problems already. Thank you, Ken.
_______________________________________________
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