[ovs-dev] [PATCHv16 1/2] ovs-thread: Add pthread spin lock support.

William Tu u9012063 at gmail.com
Mon Jul 15 20:58:34 UTC 2019

On Mon, Jul 15, 2019 at 11:54 AM Ben Pfaff <blp at ovn.org> wrote:
> On Mon, Jul 15, 2019 at 05:28:44PM +0300, Ilya Maximets wrote:
> > On 13.07.2019 2:50, William Tu wrote:
> > > The patch adds the basic spin lock functions:
> > > ovs_spin_{lock, try_lock, unlock, init, destroy}.
> > > OSX does not support pthread spin lock, so make it
> > > linux only.
> >
> > IIUC, pthread spinlock requires some specific glibc verions (>= 2.2)
> > so it could be not supported even on Linux. Instead of checking
> > _POSIX_C_SOURCE version, I think it's better to just check for
> > pthread_spin_lock function in configure script with AC_CHECK_FUNC and
> > check for the resulted macro.
> > Additionally we could check for this macro while checking AF_XDP support
> > to not enable it if we have no spinlocks.
> glibc 2.2 was released in 2000.  I don't think that it is worth worrying
> that a user might have such an ancient version of glibc.
> However, I think that feature checks are generally better, so I support
> the change.

Thanks Ben and Ilya.

I will add AC_CHECK_FUNC for checking the existence of
pthread_spin_lock. If not exist, this patch won't get compile
in and the following AF_XDP will be disable.

Feature Test Macro Requirements for pthread_spin_lock
_POSIX_C_SOURCE >= 200112L
Since it's been a while, I won't add the _POSIX_C_SOURCE  check.


More information about the dev mailing list