ac-archive-maintainers
[Top][All Lists]
Advanced

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

pthread read write locks


From: Todd Fisher
Subject: pthread read write locks
Date: Sat, 29 Mar 2003 21:47:20 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313

Hi,
        I'm trying to write an m4 macro check as follows:

AC_DEFUN(AC_PTHREAD_RWLOCK,
[AC_CACHE_CHECK(whether the pthread library has read write locks,
ac_cv_pthread_rwlock,
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE(
  [#include <pthread.h>],
  [
    pthread_rwlock_t rw_lock;
    pthread_rwlock_init( &rw_lock, NULL );
  ],
  ac_cv_pthread_rwlock=yes,ac_cv_pthread_rwlock=no)
  AC_LANG_RESTORE
])
if test "$ac_cv_pthread_rwlock" = yes; then
AC_DEFINE(HAVE_PTHREAD_RWLOCK,1,[define if posix thread library supports Read/Write Locks])
fi
])

although this is not working as I would expect because on a system where the following source compiles:

#include <pthread.h>

int main()
{
    pthread_rwlock_t rw_lock;
    pthread_rwlock_init( &rw_lock, NULL );
    return 0;
}

without issue that m4 check in my autoconf configure script
does not correctly assign ac_cv_pthread_rwlock equal to yes and
therefore does not define the HAVE_PTHREAD_RWLOCK to 1.

I am rather stumped on this and have spent sometime looking over it
as well as for similar examples online.  The closest I could fine
is the acx_pthread.m4 on this site, which does not appear to check
for this feature.

thank you in advance for any help

-todd





reply via email to

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