feat update
All checks were successful
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 1m33s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 1m32s
linux-mips64-gcc / linux-gcc-mips64el (push) Successful in 1m16s

This commit is contained in:
tqcq 2024-03-30 08:54:42 +08:00
parent 7dd4652964
commit a74cf3219c
4 changed files with 40 additions and 41 deletions

View File

@ -44,8 +44,7 @@ target_include_directories(sled PUBLIC include 3party/eigen 3party/inja
3party/rxcpp)
target_sources(
sled
PRIVATE
src/async/async.cc
PRIVATE src/async/async.cc
src/filesystem/path.cc
src/log/log.cc
src/network/async_resolver.cc
@ -90,10 +89,8 @@ endif()
target_link_libraries(
sled
PUBLIC rpc_core fmt marl
Async++
# protobuf::libprotobuf
# ${WHOLE_ARCHIVE_WRAPPER_START}
PUBLIC rpc_core fmt marl Async++
# protobuf::libprotobuf ${WHOLE_ARCHIVE_WRAPPER_START}
tcmalloc_and_profiler_static
# ${WHOLE_ARCHIVE_WRAPPER_END}
)
@ -128,7 +125,7 @@ if(SLED_BUILD_TESTS)
src/async/async_test.cc
src/any_test.cc
src/filesystem/path_test.cc
src/futures/promise_test.cc
# src/futures/promise_test.cc
src/futures/detail/just_test.cc
src/log/fmt_test.cc
# src/profiling/profiling_test.cc
@ -141,8 +138,12 @@ if(SLED_BUILD_TESTS)
src/system/thread_pool_test.cc
src/rx_test.cc
src/uri_test.cc)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(sled_tests PRIVATE -Wthread-safety)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
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()
target_link_libraries(sled_tests PRIVATE sled GTest::gtest GTest::gtest_main)
add_test(NAME sled_tests COMMAND sled_tests)

View File

@ -21,8 +21,9 @@ public:
{
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 future = task_ptr->get_future();
scheduler_->enqueue(marl::Task([task_ptr]() { (*task_ptr)(); }));
return task_ptr->get_future();
return future;
}
void Delete() override;

View File

@ -27,9 +27,5 @@ TEST(Async, parallel_for)
TEST(Async, parallel_reduce)
{
auto r = async::parallel_reduce(async::irange(1, 5), 0, [](int x, int y) {
LOGD("", "{},{}", x, y);
return x + y;
});
LOGD("", "{}", r);
auto r = async::parallel_reduce(async::irange(1, 5), 0, [](int x, int y) { return x + y; });
}

1
src/sanitizer_test.cc Normal file
View File

@ -0,0 +1 @@
#include <gtest/gtest.h>