Skip to content

Commit

Permalink
Move the complete library to stlab/concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixPetriconi committed Jun 5, 2017
1 parent 00725f7 commit fdbfacb
Show file tree
Hide file tree
Showing 35 changed files with 106 additions and 93 deletions.
32 changes: 14 additions & 18 deletions CMakeLists.txt
Expand Up @@ -5,39 +5,35 @@ project(stlab C CXX)


set(CMAKE_SKIP_RPATH OFF) set(CMAKE_SKIP_RPATH OFF)


if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
#set(CMAKE_CXX_FLAGS "-g -Wall -O3 -std=c++14 -fsanitize=thread -fexceptions -D_GLIBCXX_USE_CXX11_ABI=0") #set(CMAKE_CXX_FLAGS "-g -Wall -O3 -std=c++14 -fsanitize=thread -fexceptions -D_GLIBCXX_USE_CXX11_ABI=0")
set(CMAKE_CXX_FLAGS "-O3 -g -Wall -std=c++14 -fexceptions -ftemplate-backtrace-limit=0 -D_GLIBCXX_USE_CXX11_ABI=0") set(CMAKE_CXX_FLAGS "-O3 -g -Wall -std=c++14 -fexceptions -ftemplate-backtrace-limit=0 -D_GLIBCXX_USE_CXX11_ABI=0")
set(CMAKE_LINK_FLAGS "-pthreads") set(CMAKE_LINK_FLAGS "-pthreads")
SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}) SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS})
endif() endif()


set (Boost_MULTITHREADED ON) set (Boost_MULTITHREADED ON)


if(WIN32) if(WIN32)
add_definitions(-D_WIN32_WINNT=0x0601) add_definitions(-D_WIN32_WINNT=0x0601)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") set(Boost_USE_STATIC_LIBS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
else()
set (Boost_USE_STATIC_LIBS ON)
endif(WIN32) endif(WIN32)


if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
set(CONAN_SYSTEM_INCLUDES ON) set(CONAN_SYSTEM_INCLUDES ON)
conan_basic_setup() conan_basic_setup()
else() else()
if(MSVC)
set(Boost_USE_STATIC_LIBS TRUE)
endif()

find_package(Boost 1.60.0 COMPONENTS unit_test_framework) find_package(Boost 1.60.0 COMPONENTS unit_test_framework)


if(UNIX)
add_definitions("-DBOOST_TEST_DYN_LINK")
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIR}) include_directories(SYSTEM ${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR}) link_directories(${Boost_LIBRARY_DIR})
endif() endif()


set (Boost_MULTITHREADED ON) set (Boost_MULTITHREADED ON)


set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(CMAKE_THREAD_PREFER_PTHREAD TRUE)


Expand All @@ -50,4 +46,4 @@ endif()
include_directories(.) include_directories(.)


add_subdirectory(test) add_subdirectory(test)
add_subdirectory(playground) add_subdirectory(playground)
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@ Once they're set up, run either `setup_xcode.sh` or `setup_msvc.bat` for the pla


# Build Status: [![Build Status](https://travis-ci.org/stlab/libraries.svg?branch=develop)](https://travis-ci.org/stlab/libraries) # Build Status: [![Build Status](https://travis-ci.org/stlab/libraries.svg?branch=develop)](https://travis-ci.org/stlab/libraries)


## <stlab/future> ## <stlab/concurrency/future>


This is a proof of concept implementation of a packaged task and future to replace the standard components. This is a list of some of the differences from standard (as of C++17) and boost (as of boost 1.60.0): This is a proof of concept implementation of a packaged task and future to replace the standard components. This is a list of some of the differences from standard (as of C++17) and boost (as of boost 1.60.0):


Expand Down
7 changes: 3 additions & 4 deletions playground/CMakeLists.txt
Expand Up @@ -13,10 +13,9 @@ include_directories(${Boost_INCLUDE_DIRS})


target_link_libraries( target_link_libraries(
playground playground
# future ${Boost_LIBRARIES}
${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}
${Boost_THREAD_LIBRARY} ${CONAN_LIBS})
${CMAKE_THREAD_LIBS_INIT})




set_property(TARGET playground PROPERTY CXX_STANDARD 14) set_property(TARGET playground PROPERTY CXX_STANDARD 14)
Expand Down
7 changes: 2 additions & 5 deletions playground/main.cpp
Expand Up @@ -13,9 +13,7 @@ struct IUnknown;
#include <sstream> #include <sstream>
#include <utility> #include <utility>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/default_executor.hpp>
#include <stlab/future.hpp>


using namespace stlab; using namespace stlab;
using namespace std; using namespace std;
Expand Down Expand Up @@ -239,8 +237,7 @@ void activeProgressExample()
#include <tuple> #include <tuple>
#include <iostream> #include <iostream>


#include <stlab/future.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/channel.hpp>


using namespace stlab; using namespace stlab;
using namespace std; using namespace std;
Expand Down
30 changes: 12 additions & 18 deletions src/CMakeLists.txt
Expand Up @@ -6,23 +6,17 @@ include_directories("${PROJECT_SOURCE_DIR}/..")
#) #)


set(HEADERS set(HEADERS
../stlab/channel.hpp ../stlab/concurrency/channel.hpp
../stlab/config.hpp ../stlab/concurrency/config.hpp
../stlab/default_executor.hpp ../stlab/concurrency/default_executor.hpp
../stlab/executor_base.hpp ../stlab/concurrency/executor_base.hpp
../stlab/expected.hpp ../stlab/concurrency/future.hpp
../stlab/future.hpp ../stlab/concurrency/immediate_executor.hpp
../stlab/immediate_executor.hpp ../stlab/concurrency/main_executor.hpp
../stlab/main_executor.hpp ../stlab/concurrency/progress.hpp
../stlab/progress.hpp ../stlab/concurrency/system_timer.hpp
../stlab/traits.hpp ../stlab/concurrency/traits.hpp
../stlab/tuple_algorithm.hpp ../stlab/concurrency/tuple_algorithm.hpp
../stlab/system_timer.hpp ../stlab/concurrency/utility.hpp)
../stlab/utility.hpp)


include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})

#add_library(future ${SOURCE} ${HEADERS})
#set_property(TARGET future PROPERTY CXX_STANDARD 14)
#set_property(TARGET future PROPERTY CXX_STANDARD_REQUIRED ON)

6 changes: 3 additions & 3 deletions stlab/channel.hpp → stlab/concurrency/channel.hpp
Expand Up @@ -22,9 +22,9 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>


#include <stlab/executor_base.hpp> #include "executor_base.hpp"
#include <stlab/traits.hpp> #include "traits.hpp"
#include <stlab/tuple_algorithm.hpp> #include "tuple_algorithm.hpp"




#ifdef max #ifdef max
Expand Down
22 changes: 22 additions & 0 deletions stlab/concurrency/concurrency.hpp
@@ -0,0 +1,22 @@
/*
Copyright 2017 Adobe
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

/**************************************************************************************************/

#ifndef STLAB_CONCURRENCY_HPP
#define STLAB_CONCURRENCY_HPP

#include "channel.hpp"
#include "default_executor.hpp"
#include "executor_base.hpp"
#include "future.hpp"
#include "immediate_executor.hpp"
#include "main_executor.hpp"
#include "system_timer.hpp"
#include "utility.hpp"

#endif

File renamed without changes.
File renamed without changes.
Expand Up @@ -9,7 +9,7 @@


#include <chrono> #include <chrono>
#include <functional> #include <functional>
#include <stlab/system_timer.hpp> #include "system_timer.hpp"


/**************************************************************************************************/ /**************************************************************************************************/


Expand Down
6 changes: 3 additions & 3 deletions stlab/future.hpp → stlab/concurrency/future.hpp
Expand Up @@ -17,9 +17,9 @@
#include <vector> #include <vector>


#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <stlab/config.hpp> #include "config.hpp"
#include <stlab/executor_base.hpp> #include "executor_base.hpp"
#include <stlab/traits.hpp> #include "traits.hpp"


/**************************************************************************************************/ /**************************************************************************************************/


Expand Down
Expand Up @@ -27,7 +27,7 @@ struct immediate_executor
} }


template <typename F> template <typename F>
void operator()(std::chrono::system_clock::time_point, && f) { void operator()(std::chrono::system_clock::time_point, F&& f) {
std::forward<F>(f)(); std::forward<F>(f)();
} }
}; };
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion stlab/utility.hpp → stlab/concurrency/utility.hpp
Expand Up @@ -19,7 +19,7 @@


#endif #endif


#include <stlab/default_executor.hpp> #include "default_executor.hpp"


/**************************************************************************************************/ /**************************************************************************************************/


Expand Down
24 changes: 12 additions & 12 deletions test/CMakeLists.txt
Expand Up @@ -21,18 +21,18 @@ set(SOURCE
) )


set(HEADERS set(HEADERS
../stlab/channel.hpp ../stlab/concurrency/channel.hpp
../stlab/config.hpp ../stlab/concurrency/config.hpp
../stlab/default_executor.hpp ../stlab/concurrency/default_executor.hpp
../stlab/executor_base.hpp ../stlab/concurrency/executor_base.hpp
../stlab/future.hpp ../stlab/concurrency/future.hpp
../stlab/immediate_executor.hpp ../stlab/concurrency/immediate_executor.hpp
../stlab/main_executor.hpp ../stlab/concurrency/main_executor.hpp
../stlab/progress.hpp ../stlab/concurrency/progress.hpp
../stlab/traits.hpp ../stlab/concurrency/system_timer.hpp
../stlab/tuple_algorithm.hpp ../stlab/concurrency/traits.hpp
../stlab/system_timer.hpp ../stlab/concurrency/tuple_algorithm.hpp
../stlab/utility.hpp ../stlab/concurrency/utility.hpp
channel_test_helper.hpp channel_test_helper.hpp
test_helper.hpp test_helper.hpp
) )
Expand Down
3 changes: 1 addition & 2 deletions test/channel_functor_tests.cpp
Expand Up @@ -8,8 +8,7 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/future.hpp>


#include <vector> #include <vector>


Expand Down
4 changes: 2 additions & 2 deletions test/channel_join_tests.cpp
Expand Up @@ -8,8 +8,8 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/future.hpp>
#include <string> #include <string>


#include "channel_test_helper.hpp" #include "channel_test_helper.hpp"
Expand Down
3 changes: 1 addition & 2 deletions test/channel_merge_tests.cpp
Expand Up @@ -8,8 +8,7 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/future.hpp>


#include "channel_test_helper.hpp" #include "channel_test_helper.hpp"


Expand Down
3 changes: 1 addition & 2 deletions test/channel_process_tests.cpp
Expand Up @@ -8,8 +8,7 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/future.hpp>


#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
Expand Down
3 changes: 1 addition & 2 deletions test/channel_test_helper.hpp
Expand Up @@ -9,8 +9,7 @@
#ifndef _CHANNEL_TEST_HELPER_ #ifndef _CHANNEL_TEST_HELPER_
#define _CHANNEL_TEST_HELPER_ #define _CHANNEL_TEST_HELPER_


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/default_executor.hpp>


#include <queue> #include <queue>
#include <thread> #include <thread>
Expand Down
3 changes: 1 addition & 2 deletions test/channel_tests.cpp
Expand Up @@ -8,8 +8,7 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/future.hpp>


#include "channel_test_helper.hpp" #include "channel_test_helper.hpp"


Expand Down
3 changes: 1 addition & 2 deletions test/channel_zip_tests.cpp
Expand Up @@ -8,8 +8,7 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>


#include <stlab/channel.hpp> #include <stlab/concurrency/concurrency.hpp>
#include <stlab/future.hpp>


#include <string> #include <string>


Expand Down
3 changes: 2 additions & 1 deletion test/future_recover_tests.cpp
Expand Up @@ -7,7 +7,8 @@
/**************************************************************************************************/ /**************************************************************************************************/


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>


#include "test_helper.hpp" #include "test_helper.hpp"


Expand Down
3 changes: 2 additions & 1 deletion test/future_tests.cpp
Expand Up @@ -8,7 +8,8 @@


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/mpl/list.hpp> #include <boost/mpl/list.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>


#include "test_helper.hpp" #include "test_helper.hpp"


Expand Down
3 changes: 2 additions & 1 deletion test/future_then_tests.cpp
Expand Up @@ -7,7 +7,8 @@
/**************************************************************************************************/ /**************************************************************************************************/


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>


#include "test_helper.hpp" #include "test_helper.hpp"


Expand Down
4 changes: 3 additions & 1 deletion test/future_when_all_arguments_tests.cpp
Expand Up @@ -7,7 +7,9 @@
/**************************************************************************************************/ /**************************************************************************************************/


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>

#include <string> #include <string>


#include "test_helper.hpp" #include "test_helper.hpp"
Expand Down
3 changes: 2 additions & 1 deletion test/future_when_all_range_tests.cpp
Expand Up @@ -7,7 +7,8 @@
/**************************************************************************************************/ /**************************************************************************************************/


#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>


#include "test_helper.hpp" #include "test_helper.hpp"


Expand Down
7 changes: 5 additions & 2 deletions test/future_when_any_arguments_tests.cpp
Expand Up @@ -6,9 +6,12 @@


/**************************************************************************************************/ /**************************************************************************************************/


#include <array>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>

#include <array>


#include "test_helper.hpp" #include "test_helper.hpp"


Expand Down
7 changes: 5 additions & 2 deletions test/future_when_any_range_tests.cpp
Expand Up @@ -6,9 +6,12 @@


/**************************************************************************************************/ /**************************************************************************************************/


#include <array>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stlab/future.hpp>
#include <stlab/concurrency/concurrency.hpp>

#include <array>


#include "test_helper.hpp" #include "test_helper.hpp"


Expand Down

0 comments on commit fdbfacb

Please sign in to comment.