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

Re: [Xen-devel] [PATCH 15/15] libxl: New event generation API



On Fri, 2011-12-09 at 18:48 +0000, Ian Jackson wrote:
> Now Linux and Xen have a tendency, when they need a name for an
> unlocked version of foo, to use the name _foo.  Obviously this is no
> good in a userspace program and anyway I think it is a completely
> ridiculous convention.  We need something much clearer.
> 
> foo_internal is a possibility but that merely suggests that the
> GC_INIT has been done, and doesn't make it 100% clear that the caller
> must already have done CTX_LOCK. 

Some places also use foo_raw, not sure how much of an improvement that
is though.

Maybe a simple comment is sufficient:

/* Must be called with $LOCK held */
int libxl_event_check(libxl_ctx *ctx, libxl_event **event_r,
        ...

It's a shame there is no pthread_mutex_is_locked or an assert containing
it would be nicely self documenting. I suppose CTX_LOCK could set a flag
in the context which we could assert on, but, ick.

Stepping back a bit: Since the lock is recursive do we really need the
unlocked version? All the callers of event_check_unlocked (apart from
libxl_event_check) could call libxl_event_check instead.

Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.