From e6bf88d4350990ca65f4f848de6e690c73ab918e Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 4 May 2007 20:52:30 +0000 Subject: [PATCH] use the already available BLocker instead of atomic_add and a semaphore git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21025 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/opengl/GLView.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/kits/opengl/GLView.cpp b/src/kits/opengl/GLView.cpp index d5f5ec61e8..7656f43db0 100644 --- a/src/kits/opengl/GLView.cpp +++ b/src/kits/opengl/GLView.cpp @@ -45,9 +45,7 @@ struct glview_direct_info { direct_buffer_info *direct_info; bool direct_connected; bool enable_direct_mode; - sem_id draw_sem; - int32 draw_lock; - + glview_direct_info(); ~glview_direct_info(); }; @@ -374,10 +372,7 @@ BGLView::lock_draw() if (!info || !info->enable_direct_mode) return; - if (atomic_add(&info->draw_lock, 1) > 0) { - while (acquire_sem(info->draw_sem) == B_INTERRUPTED) - ; - } + m_drawLock.Lock(); } @@ -389,8 +384,7 @@ BGLView::unlock_draw() if (!info || !info->enable_direct_mode) return; - if (atomic_add(&info->draw_lock, -1) > 1) - release_sem(info->draw_sem); + m_drawLock.Unlock(); } @@ -551,14 +545,11 @@ glview_direct_info::glview_direct_info() direct_info = (direct_buffer_info *)calloc(1, B_PAGE_SIZE); direct_connected = false; enable_direct_mode = false; - draw_sem = create_sem(0, "glview_draw_sem"); - draw_lock = 0; } glview_direct_info::~glview_direct_info() { free(direct_info); - delete_sem(draw_sem); }