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

Some Windows-related fixes. #217

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ option(COLLAGE_BUILD_V2_API

set(COLLAGE_INCLUDE_NAME co)
set(COLLAGE_DEB_DEPENDS librdmacm-dev libibverbs-dev librdmacm-dev libudt-dev
libboost-date-time-dev libboost-regex-dev libboost-serialization-dev
libboost-system-dev libboost-thread-dev libboost-program-options-dev)
libboost-date-time-dev libboost-regex-dev libboost-system-dev
libboost-thread-dev libboost-program-options-dev)
set(COLLAGE_PORT_DEPENDS boost)

include(Common)
Expand All @@ -33,7 +33,7 @@ set(COLLAGE_LICENSE LGPL)
set(COLLAGE_DEPENDENT_LIBRARIES Boost Lunchbox Pression)

common_find_package(Boost REQUIRED COMPONENTS system regex date_time
serialization program_options thread)
program_options thread)
common_find_package(Lunchbox REQUIRED)
common_find_package(OFED)
common_find_package(OpenMP)
Expand Down
1 change: 0 additions & 1 deletion co/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ list(APPEND COLLAGE_LINK_LIBRARIES
if(NOT Boost_USE_STATIC_LIBS)
list(APPEND COLLAGE_LINK_LIBRARIES ${Boost_DATE_TIME_LIBRARY})
endif()
add_definitions(-DBOOST_ARCHIVE_SOURCE)

if(WIN32)
list(APPEND COLLAGE_LINK_LIBRARIES ws2_32 mswsock)
Expand Down
6 changes: 3 additions & 3 deletions co/connectionSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ bool ConnectionSet::_setupFDSet()
_impl->fdSetResult.append(res);

// add regular connections
_impl->lock.set();
_impl->lock.lock();
for (ConnectionsCIter i = _impl->connections.begin();
i != _impl->connections.end(); ++i)
{
Expand All @@ -565,7 +565,7 @@ bool ConnectionSet::_setupFDSet()
<< ", connection does not provide a read handle"
<< std::endl;
_impl->connection = connection;
_impl->lock.unset();
_impl->lock.unlock();
return false;
}

Expand All @@ -588,7 +588,7 @@ bool ConnectionSet::_setupFDSet()
result.thread = thread;
_impl->fdSetResult.append(result);
}
_impl->lock.unset();
_impl->lock.unlock();
#else // _WIN32
pollfd fd;
fd.events = POLLIN;
Expand Down
23 changes: 16 additions & 7 deletions co/dataIStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class DataIStream
template <class T>
DataIStream& operator>>(Array<T> array)
{
_readArray(array, boost::has_trivial_copy<T>());
_readArray(array, boost::is_pod<T>());
return *this;
}

Expand Down Expand Up @@ -208,29 +208,38 @@ class DataIStream

/** Read a plain data item. */
template <class T>
void _read(T& value, const boost::true_type&)
void _read(T& value, boost::true_type)
{
_read(&value, sizeof(value));
}

/** Read a non-plain data item. */
template <class T>
void _read(T& value, const boost::false_type&)
void _read(T& value, boost::false_type)
{
_readSerializable(value, boost::is_base_of<servus::Serializable, T>());
constexpr bool isSerializable = std::is_base_of<servus::Serializable, T>::value;
// static_assert(isSerializable, "Attempting to read non-serializable object");
_readSerializable(value, boost::integral_constant<bool, isSerializable>());
}

/** Read a non-serializable object as plain data item (fallback). */
template <class T>
void _readSerializable(T& value, boost::false_type)
{
_read(&value, sizeof(value));
}

/** Read a serializable object. */
template <class T>
void _readSerializable(T& value, const boost::true_type&);
void _readSerializable(T& value, boost::true_type);

/** Read an Array of POD data */
template <class T>
void _readArray(Array<T>, const boost::true_type&);
void _readArray(Array<T>, boost::true_type);

/** Read an Array of non-POD data */
template <class T>
void _readArray(Array<T>, const boost::false_type&);
void _readArray(Array<T>, boost::false_type);
};
}

Expand Down
8 changes: 4 additions & 4 deletions co/dataIStream.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,29 @@ inline DataIStream& DataIStream::operator>>(Object*& object)

/** Deserialize an inline serializable object. */
template <class T>
void DataIStream::_readSerializable(T& object, const boost::true_type&)
void DataIStream::_readSerializable(T& object, boost::true_type)
{
const size_t size = read<size_t>();
object.fromBinary(getRemainingBuffer(size), size);
}

/** @cond IGNORE */
template <class T>
void DataIStream::_readArray(Array<T> array, const boost::true_type&)
void DataIStream::_readArray(Array<T> array, boost::true_type)
{
_read(array.data, array.getNumBytes());
}

/** Read an Array of non-POD data */
template <class T>
void DataIStream::_readArray(Array<T> array, const boost::false_type&)
void DataIStream::_readArray(Array<T> array, boost::false_type)
{
for (size_t i = 0; i < array.num; ++i)
*this >> array.data[i];
}

template <>
inline void DataIStream::_readArray(Array<void> array, const boost::false_type&)
inline void DataIStream::_readArray(Array<void> array, boost::false_type)
{
_read(array.data, array.getNumBytes());
}
Expand Down
121 changes: 0 additions & 121 deletions co/dataIStreamArchive.cpp

This file was deleted.

Loading