[Ace-users] [ace-bugs] [ACE Autoconf setup]: [ACE_HAS_POSIX_SEM_TIMEOUT never defined under LINUX]

Peter Korf peter at niendo.de
Sat Jul 28 04:43:17 CDT 2007


Hi,

 This problem is simular to BUG# 2836 - but here are two patches.
 And I'm not permitted to edit bugs in product ACE, so I can not attach them.

   ACE VERSION: 5.5.9

   HOST MACHINE and OPERATING SYSTEM:
   Linux 2.6.18.8-0.3-default #1 SMP
   x86_64 x86_64 x86_64 GNU/Linux
   SuSE 10.2

   COMPILER NAME AND VERSION (AND PATCHLEVEL):
   gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux)

    SYNOPSIS:
Neither ACE_HAS_POSIX_SEM_TIMEOUT or ACE_HAS_POSIX_SEM_TIMEOUT_EMULATION can 
be defined using ./configure, because there is no AC_DEFINE for it.

    DESCRIPTION:
Using the traditional build (not with ./configure) everything works fine.
But using the ./configure script ACE_HAS_POSIX_SEM_TIMEOUT will not defined, 
because there is no test or anything in configure.ac for it.

In the traditional build this definition is set to 1 under Linux.

Without ACE_HAS_POSIX_SEM_TIMEOUT ACE will not wait on a timed out acquire for 
a semaphore.

This problem should be reproducible on all systems defining ACE_HAS_POSIX_SEM 
and using the configure script.


    REPEAT BY:
Write a program containing this:
  ACE_Time_Value tv = ACE_Time_Value(10) + ACE_OS::gettimeofday();
  ACE_Semaphore* sem = new ACE_Semaphore(0);
  
  sem->acquire(tv); // <-- should wait 10 seconds

  delete sem;

Using ./configure the program will not stop for 10 seconds. 
Without using ./configure it will wait.

   PATCHES:
--- ACE-5.5.9_orig/ACE_wrappers/configure.ac      2007-05-24 
05:45:22.000000000 +0000
+++ ACE-5.5.9/ACE_wrappers/configure.ac   2007-07-27 
06:16:11.000000000 +0000
@@ -4405,6 +4405,10 @@
     ,
     [AC_DEFINE([ACE_LACKS_CONDATTR_PSHARED])])

+  AC_CHECK_FUNC([pthread_cond_timedwait],
+    [AC_DEFINE([ACE_HAS_POSIX_SEM_TIMEOUT])],
+    [AC_DEFINE([ACE_HAS_POSIX_SEM_TIMEOUT_EMULATION])])
+
   AC_CHECK_FUNC([pthread_attr_setstackaddr],
     ,
     [AC_DEFINE([ACE_LACKS_THREAD_STACK_ADDR])])

--- ACE-5.5.9_orig/ACE_wrappers/m4/config_h.m4    2006-12-14 
00:14:22.000000000 +0000
+++ ACE-5.5.9/ACE_wrappers/m4/config_h.m4 2007-07-27 
06:43:41.000000000 +0000
@@ -516,6 +516,12 @@
 [Platform supports POSIX real-time semaphores (e.g., VxWorks and
    Solaris)])

+AH_TEMPLATE([ACE_HAS_POSIX_SEM_TIMEOUT],
+[Compiler supports timed mutex acquisitions (e.g. 
pthread_mutex_timedlock()).])
+
+AH_TEMPLATE([ACE_HAS_POSIX_SEM_TIMEOUT_EMULATION],
+[Emulation for timed mutex acquisitions.])
+
 AH_TEMPLATE([ACE_HAS_POSIX_TIME],
 [Platform supports the POSIX struct timespec type])

IMPORTANT NOTES:
I don't know what ACE_HAS_POSIX_SEM_TIMEOUT_EMULATION is for, but it looks 
OK, if its defined here.
Or the else entry in AC_CHECK_FUNC should be left empty.

This is only tested on one system under one operating system!

(Don't forget to run autoheader and autoconf after applying the patches)

Thanks for developing and maintaing ACE,
Peter



More information about the Ace-users mailing list