aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/native
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-13 13:47:30 +0200
committerSven Gothel <[email protected]>2011-10-13 13:47:30 +0200
commit3fd89ccc138eddb915372cff4843f69f764048a7 (patch)
treee56ee402ffbec00220e4bead29b39a73b467f48e /src/jogl/native
parent5d33b0a3ef993ff2d257c90abc3d84bc93269cd0 (diff)
MacOSX: Always release ctx on main thread (offscreen was frozen as well); Cleanup Warnings and OSX ContextUpdater
-
Diffstat (limited to 'src/jogl/native')
-rw-r--r--src/jogl/native/macosx/ContextUpdater.h8
-rw-r--r--src/jogl/native/macosx/ContextUpdater.m40
2 files changed, 18 insertions, 30 deletions
diff --git a/src/jogl/native/macosx/ContextUpdater.h b/src/jogl/native/macosx/ContextUpdater.h
index 2483ec403..3cf7315af 100644
--- a/src/jogl/native/macosx/ContextUpdater.h
+++ b/src/jogl/native/macosx/ContextUpdater.h
@@ -31,10 +31,10 @@ This notification is sent whenever an NSView that has an attached NSSurface chan
BOOL viewUpdated;
}
-+ (void) lock;
-+ (void) lockInFunction:(char *)func atLine:(int)line;
-+ (void) unlock;
-+ (void) unlockInFunction:(char *)func atLine:(int)line;
+- (void) lock;
+- (void) lockInFunction:(char *)func atLine:(int)line;
+- (void) unlock;
+- (void) unlockInFunction:(char *)func atLine:(int)line;
- (id) initWithContext:(NSOpenGLContext *)context view: (NSView *)nsView;
diff --git a/src/jogl/native/macosx/ContextUpdater.m b/src/jogl/native/macosx/ContextUpdater.m
index 64d5ef1f9..21f98ad5e 100644
--- a/src/jogl/native/macosx/ContextUpdater.m
+++ b/src/jogl/native/macosx/ContextUpdater.m
@@ -13,43 +13,31 @@ static void printLockDebugInfo(char *message, char *func, int line)
fflush(NULL);
}
-+ (void) lock
+- (void) lock
{
- if (ctx != NULL)
- {
- pthread_mutex_lock(&resourceLock);
- }
+ pthread_mutex_lock(&resourceLock);
}
-+ (void) lockInFunction:(char *)func atLine:(int)line
+- (void) lockInFunction:(char *)func atLine:(int)line
{
- if (ctx != NULL)
- {
- printLockDebugInfo("locked ", func, line);
- [self lock];
- }
+ printLockDebugInfo("locked ", func, line);
+ [self lock];
}
-+ (void) unlock
+- (void) unlock
{
- if (ctx != NULL)
- {
- pthread_mutex_unlock(&resourceLock);
- }
+ pthread_mutex_unlock(&resourceLock);
}
-+ (void) unlockInFunction:(char *)func atLine:(int)line
+- (void) unlockInFunction:(char *)func atLine:(int)line
{
- if (ctx != NULL)
- {
- printLockDebugInfo("unlocked", func, line);
- [self unlock];
- }
+ printLockDebugInfo("unlocked", func, line);
+ [self unlock];
}
- (void) update:(NSNotification *)notification
{
- [ContextUpdater lock];
+ [self lock];
NSRect r = [view frame];
if(viewRect.origin.x != r.origin.x ||
@@ -60,18 +48,18 @@ static void printLockDebugInfo(char *message, char *func, int line)
viewRect = r;
}
- [ContextUpdater unlock];
+ [self unlock];
}
- (BOOL) needsUpdate
{
BOOL r;
- [ContextUpdater lock];
+ [self lock];
r = viewUpdated;
viewUpdated = FALSE;
- [ContextUpdater unlock];
+ [self unlock];
return r;
}