feat update
This commit is contained in:
parent
7dd4652964
commit
a74cf3219c
@ -44,8 +44,7 @@ target_include_directories(sled PUBLIC include 3party/eigen 3party/inja
|
|||||||
3party/rxcpp)
|
3party/rxcpp)
|
||||||
target_sources(
|
target_sources(
|
||||||
sled
|
sled
|
||||||
PRIVATE
|
PRIVATE src/async/async.cc
|
||||||
src/async/async.cc
|
|
||||||
src/filesystem/path.cc
|
src/filesystem/path.cc
|
||||||
src/log/log.cc
|
src/log/log.cc
|
||||||
src/network/async_resolver.cc
|
src/network/async_resolver.cc
|
||||||
@ -90,10 +89,8 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
sled
|
sled
|
||||||
PUBLIC rpc_core fmt marl
|
PUBLIC rpc_core fmt marl Async++
|
||||||
Async++
|
# protobuf::libprotobuf ${WHOLE_ARCHIVE_WRAPPER_START}
|
||||||
# protobuf::libprotobuf
|
|
||||||
# ${WHOLE_ARCHIVE_WRAPPER_START}
|
|
||||||
tcmalloc_and_profiler_static
|
tcmalloc_and_profiler_static
|
||||||
# ${WHOLE_ARCHIVE_WRAPPER_END}
|
# ${WHOLE_ARCHIVE_WRAPPER_END}
|
||||||
)
|
)
|
||||||
@ -128,7 +125,7 @@ if(SLED_BUILD_TESTS)
|
|||||||
src/async/async_test.cc
|
src/async/async_test.cc
|
||||||
src/any_test.cc
|
src/any_test.cc
|
||||||
src/filesystem/path_test.cc
|
src/filesystem/path_test.cc
|
||||||
src/futures/promise_test.cc
|
# src/futures/promise_test.cc
|
||||||
src/futures/detail/just_test.cc
|
src/futures/detail/just_test.cc
|
||||||
src/log/fmt_test.cc
|
src/log/fmt_test.cc
|
||||||
# src/profiling/profiling_test.cc
|
# src/profiling/profiling_test.cc
|
||||||
@ -141,8 +138,12 @@ if(SLED_BUILD_TESTS)
|
|||||||
src/system/thread_pool_test.cc
|
src/system/thread_pool_test.cc
|
||||||
src/rx_test.cc
|
src/rx_test.cc
|
||||||
src/uri_test.cc)
|
src/uri_test.cc)
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
target_compile_options(sled_tests PRIVATE -Wthread-safety)
|
set(EXTRA_FLAGS -Wthread-safety -g -fsanitize=address
|
||||||
|
-fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
||||||
|
target_compile_options(sled_tests PRIVATE ${EXTRA_FLAGS})
|
||||||
|
|
||||||
|
target_link_options(sled_tests PRIVATE ${EXTRA_FLAGS})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(sled_tests PRIVATE sled GTest::gtest GTest::gtest_main)
|
target_link_libraries(sled_tests PRIVATE sled GTest::gtest GTest::gtest_main)
|
||||||
add_test(NAME sled_tests COMMAND sled_tests)
|
add_test(NAME sled_tests COMMAND sled_tests)
|
||||||
|
@ -21,8 +21,9 @@ public:
|
|||||||
{
|
{
|
||||||
std::function<decltype(f(args...))()> func = std::bind(std::forward<F>(f), std::forward<Args>(args)...);
|
std::function<decltype(f(args...))()> func = std::bind(std::forward<F>(f), std::forward<Args>(args)...);
|
||||||
auto task_ptr = std::make_shared<std::packaged_task<decltype(f(args...))()>>(func);
|
auto task_ptr = std::make_shared<std::packaged_task<decltype(f(args...))()>>(func);
|
||||||
|
auto future = task_ptr->get_future();
|
||||||
scheduler_->enqueue(marl::Task([task_ptr]() { (*task_ptr)(); }));
|
scheduler_->enqueue(marl::Task([task_ptr]() { (*task_ptr)(); }));
|
||||||
return task_ptr->get_future();
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Delete() override;
|
void Delete() override;
|
||||||
|
@ -27,9 +27,5 @@ TEST(Async, parallel_for)
|
|||||||
|
|
||||||
TEST(Async, parallel_reduce)
|
TEST(Async, parallel_reduce)
|
||||||
{
|
{
|
||||||
auto r = async::parallel_reduce(async::irange(1, 5), 0, [](int x, int y) {
|
auto r = async::parallel_reduce(async::irange(1, 5), 0, [](int x, int y) { return x + y; });
|
||||||
LOGD("", "{},{}", x, y);
|
|
||||||
return x + y;
|
|
||||||
});
|
|
||||||
LOGD("", "{}", r);
|
|
||||||
}
|
}
|
||||||
|
1
src/sanitizer_test.cc
Normal file
1
src/sanitizer_test.cc
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include <gtest/gtest.h>
|
Loading…
x
Reference in New Issue
Block a user