[Piglit] [PATCH 1/2] framework/log: declare the state and state lock together

Dylan Baker baker.dylan.c at gmail.com
Tue Sep 22 12:41:21 PDT 2015


I haven't tested this yet, but this looks like it breaks the existing
loggers, have you tested this with the Quiet and Verbose logs?

On Tue, Sep 22, 2015 at 05:22:23PM +0100, Thomas Wood wrote:
> Declare the state and state lock variables at the same time so that the
> same lock can be always used when accessing the state variable.
> 
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
>  framework/log.py | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/framework/log.py b/framework/log.py
> index 759974a..6d5a31c 100644
> --- a/framework/log.py
> +++ b/framework/log.py
> @@ -51,9 +51,10 @@ class BaseLog(object):
>      SUMMARY_KEYS = set([
>          'pass', 'fail', 'warn', 'crash', 'skip', 'dmesg-warn', 'dmesg-fail',
>          'dry-run', 'timeout'])
> -    _LOCK = threading.Lock()
> +    _LOCK = None
>  
> -    def __init__(self, state):
> +    def __init__(self, state, state_lock):
> +        self._LOCK = state_lock
>          self._state = state
>          self._pad = len(str(state['total']))
>  
> @@ -285,7 +286,8 @@ class LogManager(object):
>              'complete': 0,
>              'running': [],
>          }
> +        self._state_lock = threading.Lock()
>  
>      def get(self):
>          """ Return a new log instance """
> -        return self._log(self._state)
> +        return self._log(self._state, self._state_lock)
> -- 
> 1.9.1
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150922/6fba499c/attachment.sig>


More information about the Piglit mailing list