New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix OSX build #2790
Fix OSX build #2790
Conversation
Linker was complaining because of multiple definitions. The header was being included in multiple places, and they were each getting and exporting their own instance of the mutex.
In C++17 we could've just made it inline. But this looks fine, presuming that CI comes back green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@@ -36,7 +36,6 @@ | |||
#else | |||
#include <hpx/lcos/local/spinlock.hpp> | |||
#include <mutex> | |||
hpx::lcos::local::spinlock gmtime_call_mutex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In C++17 we could have just added inline here.
@brycelelbach: we try to stick to C++11 (for unguarded code), so this fix is correct. |
@@ -105,7 +104,8 @@ template<class convert = do_convert_format::prepend> struct high_precision_time_ | |||
// fall back to non-thread-safe version on other platforms | |||
std::tm local_tm; | |||
{ | |||
std::unique_lock<hpx::lcos::local::spinlock> ul(gmtime_call_mutex); | |||
static hpx::lcos::local::spinlock mutex; | |||
std::unique_lock<hpx::lcos::local::spinlock> ul(mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine; note that this code is surrounded in the same #ifdef/#endif block as the above diff, although the #ifdef/#endif aren't visible in this patch..
@hkaiser: I know :). Just mentioning it. |
Hrm, why is the AppVeyor build failing? |
Linker was complaining because of multiple definitions. The header was being included in multiple places, and they were each getting and exporting their own instance of the mutex.
This was broken in 0d9d74d