On Mon, Apr 23, 2018 at 13:39:25 +0800, Peter Xu wrote:
> Introduce some hooks for the shared part of qemu thread between POSIX
> and Windows implementations.  Note that in qemu_mutex_unlock_impl() we
> moved the call before unlock operation which should make more sense.
> And we don't need qemu_mutex_post_unlock() hook.
> 
> Currently the hooks only calls the tracepoints.
> 
> Put all these shared hooks into the header files.  It should be internal
> to qemu-thread but not for qemu-thread users, hence put into util/
> directory.
> 
> Signed-off-by: Peter Xu <pet...@redhat.com>
> ---
(snip)
> @@ -92,11 +90,10 @@ void qemu_mutex_unlock_impl(QemuMutex *mutex, const char 
> *file, const int line)
>      int err;
>  
>      assert(mutex->initialized);
> +    qemu_mutex_pre_unlock(mutex, file, line);
>      err = pthread_mutex_unlock(&mutex->lock);
>      if (err)
>          error_exit(err, __func__);
> -
> -    trace_qemu_mutex_unlock(mutex, file, line);
>  }
(snip)
> @@ -81,7 +80,7 @@ int qemu_mutex_trylock_impl(QemuMutex *mutex, const char 
> *file, const int line)
>  void qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, const int 
> line)
>  {
>      assert(mutex->initialized);
> -    trace_qemu_mutex_unlock(mutex, file, line);
> +    qemu_mutex_pre_unlock(mutex, file, line);
>      ReleaseSRWLockExclusive(&mutex->lock);
>  }

Note that in posix we're moving the unlock tracepoint before the actual
unlock happens. But that makes it consistent with that we're doing in win32,
and AFAICT it seems a better place to do it, so:

Reviewed-by: Emilio G. Cota <c...@braap.org>

Thanks,

                E.

Reply via email to