[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Thread-safe graphics manager
From: |
Shai Ayal |
Subject: |
Re: [PATCH] Thread-safe graphics manager |
Date: |
Sat, 5 Jul 2008 07:29:14 +0300 |
On Sat, Jul 5, 2008 at 12:39 AM, Maciek Gajewski
<address@hidden> wrote:
> Hello
>
> Attached is my implementation of locking in gh_manager. I sent it here for
> review.
> It's based on Michael Goffioul's patch from January (
> http://www.nabble.com/Octave-backend-synchronization-td15038411.html ).
>
> This implementation differs from Michael's in few ways:
>
> - Mutex initialization is moved to gh_manager constructor. Previous version
> wasn't thread safe - possiblerace could occur during first lock() invocation,
> when two threads could start initializing mutex simultaneously.
> - Mutex is explicitly defined as recursive, allowinf for nested locks/unlocks.
> - Added simle lock_guard object which simplifies mutex usage.
> - Locking is added in many more places:
> * everywhere where object is obtained and it's properties changed,
> * where multiple properties are being manipulated/read, to maintain
> consistency,
> * in higher-level methods, like 'xset' or 'get_property_from_handle' to make
> them atomic.
>
> It doesn't use boosts. Michael's implementation for Windows using critical
> section is still there, and pthread-based for Unix is added.
So does this mean the Mac guys are left out?
Shai