mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
Fix ogl test hang
Summary: See https://github.com/facebookresearch/pytorch3d/issues/1908 Reviewed By: MichaelRamamonjisoa Differential Revision: D65280253 fbshipit-source-id: ec05902c5f2f7eb9ddd92bda0045cc3564b8c091
This commit is contained in:
parent
8fe6934885
commit
81d82980bc
@ -184,7 +184,7 @@ class EGLContext:
|
|||||||
"""
|
"""
|
||||||
# Lock used to prevent multiple threads from rendering on the same device
|
# Lock used to prevent multiple threads from rendering on the same device
|
||||||
# at the same time, creating/destroying contexts at the same time, etc.
|
# at the same time, creating/destroying contexts at the same time, etc.
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.RLock()
|
||||||
self.cuda_device_id = cuda_device_id
|
self.cuda_device_id = cuda_device_id
|
||||||
self.device = _get_cuda_device(self.cuda_device_id)
|
self.device = _get_cuda_device(self.cuda_device_id)
|
||||||
self.width = width
|
self.width = width
|
||||||
@ -224,7 +224,7 @@ class EGLContext:
|
|||||||
Throws:
|
Throws:
|
||||||
EGLError when the context cannot be made current or make non-current.
|
EGLError when the context cannot be made current or make non-current.
|
||||||
"""
|
"""
|
||||||
self.lock.acquire()
|
with self.lock:
|
||||||
egl.eglMakeCurrent(self.dpy, self.surface, self.surface, self.context)
|
egl.eglMakeCurrent(self.dpy, self.surface, self.surface, self.context)
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
@ -232,7 +232,6 @@ class EGLContext:
|
|||||||
egl.eglMakeCurrent(
|
egl.eglMakeCurrent(
|
||||||
self.dpy, egl.EGL_NO_SURFACE, egl.EGL_NO_SURFACE, egl.EGL_NO_CONTEXT
|
self.dpy, egl.EGL_NO_SURFACE, egl.EGL_NO_SURFACE, egl.EGL_NO_CONTEXT
|
||||||
)
|
)
|
||||||
self.lock.release()
|
|
||||||
|
|
||||||
def get_context_info(self) -> Dict[str, Any]:
|
def get_context_info(self) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user