Conversation
QPID-4280: clock_gettime not available on Mac OS X Get qpid C++ building on OSX. Add documentation to INSTALL and fix up build scripts Conditionalize posix clock routines for __MACH__ sigfillset is a macro on osx. Open question around absolute time pthread wait()s.
|
This implementation doesn't follow the usual qpid portability strategy for not introducing inline conditional compilation. The way we do do this in qpid is to introduce a new file for the platform and compile that as an alternative implementation. the posix/Time.cpp file is more-or-les reimplemented so this needs to be a new file with the new implementation and not switched using long term unmaintainable #ifdefs. Also I think that you will have a fundamental problem with timekeeping if condvars can't use monotonic clocks - You will basically have to have a custom OSX implementation of timekeeping and condvars. As you can't have one use a monotonic clock without the other Also we don't need a commit to remove commented out stuff, when the it was the other commit in the pull request that introduced it, please just squash them together. |
|
I just found this and also http://web.archive.org/web/20100501115556/http://le-depotoir.googlecode.com/svn/trunk/misc/clock_gettime_stub.c which tries to provided a version of monotonic clocks on OSX, what do you think about using something like this gettime_stub on OSX to provide Monotonic clock functionality? |
|
As a way to implement clock_gettime() this seems like a good approach. However the bigger problem is the timekeeping between clock_gettime() and condition vars need to be the same. So you would either need to reimplement condvars to use CLOCK_MONOTONIC (SYSTEM_CLOCK?) or go back to using CLOCK_REALTIME in the OSX port. The reason we changed to CLOCK_MONOTONIC in the first instance is that CLOCK_REALTIME can go backwards if the system time is changed and this has bad effects on qpid. If OSX/Mach CALENDAR_CLOCK can't go backwards then this isn't important, I expect that, given its name, it can go back though. |
|
@astitcher do you have an proposed way forward with this? Being able to build qpidd on my laptop without booting up a VM would be really great |
|
@sideshowcoder have you tried using that stub locally at all? |
|
@mbroadst I tried with the stub back when I commented but only compile and made some more changes I think to actually get it to compile not sure what I got out actually worked as I since then moved to prototype on Java, but I can try again. |
|
Note that any progress here will need a new PR with this one being closed, as the code has now migrated to its own repo, which is mirrored at: https://github.com/apache/qpid-cpp |
QPID-2536: Implement posix clock_gettime
QPID-4280: clock_gettime not available on Mac OS X
QPID-4278: Broken OS X Build
Add documentation to INSTALL and fix up build scripts
Conditionalize posix clock routines for MACH
sigfillset is a macro on osx.
Open question around absolute time pthread wait()s.