# Request statistics shared by many threads: an atomic counter for one
# independent number, and a mutex for several numbers that must agree,
# with a condition variable for threads that wait for a count.
find_package(Threads REQUIRED)

add_library(adv_request_stats STATIC request_stats.cpp)
target_include_directories(adv_request_stats PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(adv_request_stats PUBLIC Threads::Threads)

lld_add_example(adv_counter SOURCES main.cpp EXPECTED_OUTPUT expected_output.txt)
target_link_libraries(adv_counter PRIVATE adv_request_stats)

lld_add_test(adv_counter_tests SOURCES tests/test_stats.cpp LABELS concurrency)
target_link_libraries(adv_counter_tests PRIVATE adv_request_stats)
