Skip to content
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

Force using pthread emulation on FreeBSD for boost/interprocess #13

Merged
merged 3 commits into from
May 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/chainbase/pinnable_mapped_file.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#pragma once

// for BSD we should avoid any pthread calls such as pthread_mutex_lock
#if defined(__FreeBSD__)
#define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any tradeoffs adding this here vs in CMake? Sometimes I get worried of introducing an ODR violation when a different .cpp file that doesn't include this .hpp uses BIP, and thus does not have BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION defined. But I didn't study BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION closely to see if that's a concern or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, done

#endif

#include <system_error>
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/asio/io_service.hpp>
#include <filesystem>

namespace chainbase {

namespace bip = boost::interprocess;
Expand Down