Boost logo

Boost :

From: Ian Fasel (ianfasel_at_[hidden])
Date: 2006-04-11 19:22:33


I was trying to use the shmem library on darwin and ran into errors
because darwin does not have a clock_gettime function.

I believe there needs to be something like a BOOST_HAS_CLOCK_GETTIME
in config.hpp -- either there, or in shmem. Then the following patch
for shmem would probably be appropriate:

--- shmemlib-0-orig/boost/shmem/sync/xtime.hpp 2005-12-30
19:32:02.000000000 +0000
+++ shmemlib-0/boost/shmem/sync/xtime.hpp 2006-04-11
22:24:09.000000000 +0000
@@ -102,12 +102,19 @@
        #else
-
+
+ #if defined BOOST_HAS_CLOCK_GETTIME
          timespec ts;
          clock_gettime(CLOCK_REALTIME, &ts);
          xtp->sec = ts.tv_sec;
          xtp->nsec = ts.tv_nsec;
- return clock_type;
+ #else
+ struct timeval tv;
+ if (gettimeofday (&tv, 0) == 0) {
+ xtp->sec = tv.tv_sec;
+ xtp->nsec = tv.tv_usec*1000;
+ }
+ #endif
        #endif
          return clock_type;

With this patch, I am able to get the examples in shmem to build.
Unfortunately, it then fails in
        boost::shmem::detail::mutexattr_wrapper::mutexattr_wrapper
because pthread_mutexattr_init fails.

I can go into more info about the problems with shmem on darwin if
this is useful to anyone. I realize this may be the wrong list for
this post since shmem is still in 0.9 development, so please point me
in the right direction if so.

-Ian Fasel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk