diff options
author | Victor Zverovich <viz@meta.com> | 2023-12-29 08:11:29 -0800 |
---|---|---|
committer | Victor Zverovich <viz@meta.com> | 2023-12-29 08:11:29 -0800 |
commit | d5823aae36fcabc683d34b8b9cfd51e9653e6569 (patch) | |
tree | a50ff7e78b7211ce87b521fc962ad048db0735a8 | |
parent | d83c1b8d4a519d8140b3ce13ac948f0fb835867f (diff) | |
download | fmtlib-d5823aae36fcabc683d34b8b9cfd51e9653e6569.tar.gz |
Ceci n'est pas une pipe
-rw-r--r-- | include/fmt/os.h | 1 | ||||
-rw-r--r-- | test/scan-test.cc | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/fmt/os.h b/include/fmt/os.h index c81955d7..3c7b3ccb 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -315,6 +315,7 @@ class FMT_API file { // Creates a pipe setting up read_end and write_end file objects for reading // and writing respectively. + // DEPRECATED! Taking files as out parameters is deprecated. static void pipe(file& read_end, file& write_end); // Creates a buffered_file object associated with this file and detaches diff --git a/test/scan-test.cc b/test/scan-test.cc index e2bfea3e..8c84ab06 100644 --- a/test/scan-test.cc +++ b/test/scan-test.cc @@ -143,6 +143,7 @@ TEST(scan_test, file) { } TEST(scan_test, lock) { + fmt::file read_end, write_end; fmt::file::pipe(read_end, write_end); @@ -152,6 +153,7 @@ TEST(scan_test, lock) { write_end.close(); }); + std::atomic<int> count = 0; fmt::buffered_file f = read_end.fdopen("r"); auto fun = [&]() { int value = 0; @@ -161,6 +163,7 @@ TEST(scan_test, lock) { EXPECT_EQ(value, 42); break; } + ++count; } }; std::thread consumer1(fun); @@ -168,5 +171,7 @@ TEST(scan_test, lock) { producer.join(); consumer1.join(); consumer2.join(); + EXPECT_EQ(count, 1000); + } #endif // FMT_USE_FCNTL |