From 011e13e22fd52d2e82697ffee6b4c9ca8f3d549a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 30 Aug 2014 11:59:13 +0200 Subject: Bug 1055 - Access and query shared master GLContext in a deterministic fashion ; Don't use arbitrary shared context as 'master'. GLContext* passes the shared-master to GLContextShareSet, which only creates a sets of shared contexts without differentiating the master context. GLContext*'s shared-slave attempts to lock the realized shared-master's surface at creation. Currently only an arbitrary shared context is selected due to the missing 'master' identity. The arbitrary shared context's surface is locked and its shared context handle used to create the slave context. Lacking of using the user given shared-master can lead to deadlock situations - and locking a 'wrong' surface. +++ The patch: - Allows query the user given shared-master! - Use the user given shared-master for locking and it's context handle for the slave's creation. - The shared-context mapping maps each shared-master to a shared-slave within one shared-context-set, allowing deterministic and individual shared-master queries. --- src/jogl/classes/javax/media/opengl/GLContext.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/jogl/classes/javax/media/opengl/GLContext.java') diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 9389ccabb..f4ba3c0b7 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -250,6 +250,16 @@ public abstract class GLContext { return GLContextShareSet.isShared(this); } + /** + * Returns the shared master GLContext of this GLContext if shared, otherwise return null. + *

+ * Returns this GLContext, if it is a shared master. + *

+ */ + public final GLContext getSharedMaster() { + return GLContextShareSet.getSharedMaster(this); + } + /** Returns a new list of created GLContext shared with this GLContext. */ public final List getCreatedShares() { return GLContextShareSet.getCreatedShares(this); -- cgit v1.2.3