Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Multithread lock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multithread lock



What is the best way to lock a NSOpenGLView, when drawing from a thread?




- (void)draw
{
if([self lockFocusIfCanDraw]){
[[self openGLContext] makeCurrentContext];


Drawing.....
glFinish();
[[NSOpenGLContext currentContext] flushBuffer];
[self unlockFocus];
}
}

- (void)drawRect:(NSRect)aRect
{
[self draw];
}


Sometimes i get a deadlock
[NSViewHierarchyLock lockForWriting]
what is the right way to implement this without a deadlock,
and not getting a panic if i don't use any lock's?






Peter Mark

Mark's Recording Studio A/S
Lundeskovsvej 3
2900 Hellerup
Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
email@hidden
_______________________________________________
mac-opengl mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-opengl
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.