Re: NSOpenGLView from a second NSThread
Re: NSOpenGLView from a second NSThread
- Subject: Re: NSOpenGLView from a second NSThread
- From: Shaun Wexler <email@hidden>
- Date: Fri, 21 May 2004 13:00:47 -0700
On May 21, 2004, at 11:11 AM, Alex Eddy wrote:
>
This is a longstanding problem with multithreaded GL. What's happening
>
is that your app is submitting GL commands to the same context from
>
two threads simultaneously, and this corrupts the GL command stream.
>
Whenever I do this on my Powerbook(s), I get a total system freeze
>
(white or static screen, no KP overlay.)
>
>
This is a programming error on your part, since the GL context must be
>
treated as a shared resource in a multithreaded application. You are
>
going to have to create a lock (NS or pthread) and use it around every
>
possible place where you submit GL commands (drawRect, resize, etc.)
Not only that, but any shared resources must also be preserved for the
lifetime of the command stream, such as client-storage for textures,
vertex array ranges, etc. There is also an issue with the GL surface,
the window server, and the main thread. Buffering modes, swap/flush
and blocking behaviors must also be considered. Once you have it
figured out though, multithreading can be amazing with OpenGL. **
>
That said, IMHO it is rather bad that you can KP the machine like this
>
(and it boils down to a handful of code to reproduce it) so I strongly
>
suggest that you make a reduced test case where this happens, and log
>
a bug at http://bugreporter.apple.com about it. User-space
>
applications shouldn't be able to toast the whole machine!
I have an old test app that will occasionally refuse to quit, and no
other app on the system can make it quit; any tool that tries to look
up its PID (top, etc) will fail. None of the CHUD tools can tap into
it. Requires a reboot, but doesn't pooch any of the rest of the
system. It's got something to do with CGS and window level, because
its window (its splash-screen) will remain frontmost, regardless.
Strange?
--
Shaun Wexler
MacFOH
http://www.macfoh.com
** will post a downloadable MacFOH demo app to illustrate this, soon.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.