On Wed, 2011-11-02 at 12:38 -0400, Ian Jackson wrote:
> Ian Campbell writes ("Re: [Xen-devel] [PATCH RFC v2 09/13] libxl: introduce
> lock in libxl_ctx"):
> > On Fri, 2011-10-28 at 19:37 +0100, Ian Jackson wrote:
> > > + const pthread_mutex_t mutex_value =
> > > PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
> ...
> > > + memcpy(&ctx->lock, &mutex_value, sizeof(ctx->lock));
> >
> > Is this subtly different to
> > ctx->lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
> > in some way I'm missing?
>
> Yes. PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is formally valid only as
> an initialiser, not necessarily as an expression. I'm not sure that
> relevant GCC extensions mean the two are always equivalent.
OK, thanks.
I just had a read of pthread_mutex(3) and I'm surprised how many hoops
one has to jump through to use pthread_mutex_init(). Well, I say
surprised...
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|