bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recent drawing optimizations


From: Alexander Malmberg
Subject: Re: Recent drawing optimizations
Date: Tue, 01 Apr 2003 16:56:01 +0200

David Ayers wrote:
[snip]
> Alexander Malmberg wrote:
[snip]
> >+  if ([NSThread currentThread] != GSAppKitThread)
>
> Calling this class method here feels *very* expensive.  Wasn't there an
> equivalent function call that might be faster? (GSCurrentThread() I
> believe.)

GSCurrentThread(), yes. I'll change it to use that function instead.
However, without doing any real benchmarking, I feel that this is
relatively cheap compared to the updating of invalid rects in the view
hierarchy and the (eventual) redraw.

> >+    {
> >+      [self performSelectorOnMainThread: @selector(_setNeedsDisplay_helper:)
> >+      withObject: [NSNumber numberWithBool: flag]
> >+      waitUntilDone: NO];
> >
> Where is this method declared/defined?  (If it was part of a previos
> patch, then please forgive me.)
> Unless this is Cocoa method, I'd suggest renaming it to
> performSelectorIn(Gui/AppKit)Thread:...

NSThread, a recent cocoa addition.

> And I wonder what it would mean if multiple threads call this method
> with diffrenent values as the parameter...

It would work just as if you called [object performSelector:
@selector(foo:) withObject: bar] multiple times, except that the method
would run in the main thread.

> The whole notion of mutiple threads explicitly or implicitly
> interafaceing with the gui seems rather dangerous to me, but I guess
> that shouldn't concern -gui.

I agree, I'm not certain that we should provide any thread-safety in
-gui at all. Eventually, it'll all have to be drawn in one thread
anyway. What did OPENSTEP do?

- Alexander Malmberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]