Skip to content

Commit

Permalink
our modifications applied - important!
Browse files Browse the repository at this point in the history
  • Loading branch information
aliakseis committed Mar 10, 2018
1 parent 99b5b83 commit e08445b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/3rdparty/torrent-rasterbar/CMakeLists.txt
Expand Up @@ -156,7 +156,7 @@ set(ed25519_sources

set(includes include ed25519/src)

option(shared "build libtorrent as a shared library" ON)
option(shared "build libtorrent as a shared library" OFF)
option(static_runtime "build libtorrent with static runtime" OFF)
option(tcmalloc "link against google performance tools tcmalloc" OFF)
option(pool-allocators "Uses a pool allocator for disk and piece buffers" ON)
Expand Down Expand Up @@ -255,7 +255,7 @@ target_compile_definitions(torrent-rasterbar PRIVATE TORRENT_BUILDING_LIBRARY)

# Boost
if(NOT DEFINED Boost_INCLUDE_DIR OR NOT DEFINED Boost_LIBRARIES)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system chrono random)
FIND_PACKAGE(Boost REQUIRED COMPONENTS system chrono random atomic date_time)
endif()
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
Expand All @@ -270,7 +270,7 @@ if (WIN32)
# prevent winsock1 to be included
add_definitions(-DWIN32_LEAN_AND_MEAN)
if (MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
# add_definitions(-DBOOST_ALL_NO_LIB)
# for multicore compilation
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# increase the number of sections for obj files
Expand Down Expand Up @@ -356,15 +356,15 @@ else()
set (LIBDIR "lib")
endif()

install(TARGETS torrent-rasterbar DESTINATION ${LIBDIR})
install(DIRECTORY include/libtorrent
DESTINATION include
PATTERN ".svn" EXCLUDE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar.pc DESTINATION ${LIBDIR}/pkgconfig)
#install(TARGETS torrent-rasterbar DESTINATION ${LIBDIR})
#install(DIRECTORY include/libtorrent
# DESTINATION include
# PATTERN ".svn" EXCLUDE)
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtorrent-rasterbar.pc DESTINATION ${LIBDIR}/pkgconfig)

# === set up examples directory as an independent project ===
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples)
configure_file(examples/run_cmake.sh.in examples/run_cmake.sh)
#file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples)
#configure_file(examples/run_cmake.sh.in examples/run_cmake.sh)
# to build the examples, run examples/run_cmake.sh after building libtorrent

# === build tests ===
Expand Down
3 changes: 3 additions & 0 deletions src/3rdparty/torrent-rasterbar/src/session_call.cpp
Expand Up @@ -82,8 +82,11 @@ void fun_wrap(bool& done, condition_variable& e, mutex& m, boost::function<void(
void torrent_wait(bool& done, aux::session_impl& ses)
{
blocking_call();
if (!done)
{
mutex::scoped_lock l(ses.mut);
while (!done) { ses.cond.wait(l); };
}
}

void sync_call(aux::session_impl& ses, boost::function<void(void)> f)
Expand Down
4 changes: 4 additions & 0 deletions src/3rdparty/torrent-rasterbar/src/thread.cpp
Expand Up @@ -139,11 +139,13 @@ namespace libtorrent

void condition_variable::notify_all()
{
if (m_num_waiters > 0)
ReleaseSemaphore(m_sem, m_num_waiters, 0);
}

void condition_variable::notify()
{
if (m_num_waiters > 0)
ReleaseSemaphore(m_sem, (std::min)(m_num_waiters, 1), 0);
}
#elif defined TORRENT_BEOS
Expand Down Expand Up @@ -180,11 +182,13 @@ namespace libtorrent

void condition_variable::notify_all()
{
if (m_num_waiters > 0)
release_sem_etc(m_sem, m_num_waiters, 0);
}

void condition_variable::notify()
{
if (m_num_waiters > 0)
release_sem_etc(m_sem, (std::min)(m_num_waiters, 1), 0);
}
#else
Expand Down

0 comments on commit e08445b

Please sign in to comment.