qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers


From: Glauber Costa
Subject: Re: [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers
Date: Wed, 25 Mar 2009 20:24:51 -0300

On Wed, Mar 25, 2009 at 7:47 PM, Marcelo Tosatti <address@hidden> wrote:
> Signed-off-by: Marcelo Tosatti <address@hidden>
>
> Index: trunk/qemu-thread.c
> ===================================================================
> --- /dev/null
> +++ trunk/qemu-thread.c
I think it all fits better as static inline defined in qemu-thread.h file.
It'll surely generate better code.

> +int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs)
> +{
> +    int r;
> +    struct timespec ts;
> +
> +    clock_gettime(CLOCK_REALTIME, &ts);
> +    timespec_add_ms(&ts, msecs);
> +
> +    r = pthread_mutex_timedlock(&mutex->lock, &ts);
> +    if (r && r != ETIMEDOUT)
> +        error_exit(__func__);
> +    return r;
> +}

Do we have in-tree users of that? Although it is a matter of personal taste,
I don't like timed locks. So if we don't have any imediate users, we
might as well
remove it for the sake of simplicity.


-- 
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]