[webkit-reviews] review granted: [Bug 174907] Update lock benchmarks : [Attachment 316588] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 27 18:24:11 PDT 2017


Filip Pizlo <fpizlo at apple.com> has granted JF Bastien <jfbastien at apple.com>'s
request for review:
Bug 174907: Update lock benchmarks
https://bugs.webkit.org/show_bug.cgi?id=174907

Attachment 316588: patch

https://bugs.webkit.org/attachment.cgi?id=316588&action=review




--- Comment #6 from Filip Pizlo <fpizlo at apple.com> ---
Comment on attachment 316588
  --> https://bugs.webkit.org/attachment.cgi?id=316588
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=316588&action=review

I think this is OK to land, but it would have been nicer if you hadn't used
std:: types.

> Source/WTF/benchmarks/ConditionSpeedTest.cpp:76
> -template<typename Functor, typename ConditionType, typename LockType>
> -void wait(ConditionType& condition, LockType& lock, const Functor&
predicate)
> +    template<typename Functor, typename ConditionType, typename LockType,
typename std::enable_if<!std::is_same<ConditionType,
std::condition_variable>::value>::type* = nullptr>
> +    void wait(ConditionType& condition, LockType& lock,
std::unique_lock<LockType>&, const Functor& predicate)
>  {
>      while (!predicate())
>	   condition.wait(lock);
>  }
>  
> +template<typename Functor, typename ConditionType, typename LockType,
typename std::enable_if<std::is_same<ConditionType,
std::condition_variable>::value>::type* = nullptr>
> +void wait(ConditionType& condition, LockType&, std::unique_lock<LockType>&
locker, const Functor& predicate)
> +{
> +    while (!predicate())
> +	   condition.wait(locker);
> +}
> +

This is really gross.  You wouldn't have had to do this if you wrote your own
SystemMutex/SystemCondition that wrapped pthread_mutex_t/pthread_cond_t.


More information about the webkit-reviews mailing list