Re: High Level Toolkit -- is it obsolete or not?
Re: High Level Toolkit -- is it obsolete or not?
- Subject: Re: High Level Toolkit -- is it obsolete or not?
- From: Joel May <email@hidden>
- Date: Tue, 23 Feb 2010 17:35:05 -0600
OK. I'm agreeing with you about not doing bad stuff.
Thanks for the info about drawing in a different thread. I won't waste my time and sanity. I guess I need to figure out how to speed up the drawing instead and keep it in the main thread.
I've switched from QuickDraw to Quarz, and performance has actually gotten worse. After reading this post:
http://www.kaourantin.net/2010/02/core-animation.html
I'm thinking about switching the quartz code to CoreAnimation. I need to blit an offscreen bitmap to the screen. I'm hoping CoreAnimation will do it faster. I haven't looked at the CoreAnimation API yet.
Thanks,
Joel
On Feb 23, 2010, at 4:49 PM, Nick Zitzmann wrote:
>
> On Feb 23, 2010, at 3:30 PM, Joel May wrote:
>
>> Question about NSThread seeing how GetKeys(), etc. are not thread safe: If I increase the priority of the main thread, then move the view draw cgcontext updates to a lower priority thread, is that a good idea? Will increasing the priority of the main thread reduce latency for getting the keypress and mouse inputs?
>
> Two words: Schrödinger's Cat. :) You won't know until you observe.
>
>> Does the OS actually honor this request?
>
> Yes, you can change a running thread's priority using NSThread. I've never had to change a main thread's priority, though.
>
>> Can I take the drawRect requests and pass the rectangle to the lower thread and update the view there?
>
> No; in all classes except for NSButton and NSProgressIndicator (and any other classes that use the old, private heart-beat API), you do threaded drawing by turning on concurrent drawing in the view. You can only do this in Snow Leopard & later, and it's not a good idea to try this unless you know for a fact that it supports thread-safe drawing. IKImageBrowserView, for example, will freeze if you turn on concurrent drawing.
>
> Also, it's been my experience that concurrent drawing is currently useless if you need to flush multiple updates to multiple views at once, because concurrent drawing changes flush immediately instead of at the same time as everything else, which could look a little strange. I have a bug open on this...
>
>> Is this crazy?
>
> Maybe.
>
>> Non-thread safety of GetKeys() and Buttons(): If I call these in the wrong thread, can they crash the application? Or is the damage limited to erroneous results?
>
> The results are most likely undefined and could change between OS releases or even individual trials. I wouldn't try if the header says it's not thread-safe.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
_______________________________________________
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