LGTM

On Fri, Apr 11, 2014 at 12:43 PM, Klaus Aehlig <[email protected]> wrote:

> ...in waiting structures. This is just a convenience wrapper
> around freeLocksPredicate.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/Locking/Waiting.hs | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/src/Ganeti/Locking/Waiting.hs b/src/Ganeti/Locking/Waiting.hs
> index 1fdd602..2d95c6a 100644
> --- a/src/Ganeti/Locking/Waiting.hs
> +++ b/src/Ganeti/Locking/Waiting.hs
> @@ -38,6 +38,7 @@ module Ganeti.Locking.Waiting
>   , fromExtRepr
>   , freeLocksPredicate
>   , downGradeLocksPredicate
> + , intersectLocks
>   ) where
>
>  import Control.Arrow ((&&&), second)
> @@ -309,3 +310,10 @@ downGradeLocksPredicate :: (Lock a, Ord b, Ord c)
>                          -> b
>                          -> LockWaiting a b c -> (LockWaiting a b c, S.Set
> b)
>  downGradeLocksPredicate = manipulateLocksPredicate L.requestShared
> +
> +-- | Intersect locks to a given set.
> +intersectLocks :: (Lock a, Ord b, Ord c)
> +               => [a]
> +               -> b
> +               -> LockWaiting a b c -> (LockWaiting a b c, S.Set b)
> +intersectLocks locks = freeLocksPredicate (not . flip elem locks)
> --
> 1.9.1.423.g4596e3a
>
>

Reply via email to