[libcxx-commits] [libcxx] [libc++] Implements filebuf unbuffered. (PR #76629)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 12 08:48:18 PDT 2024
================
@@ -337,6 +377,23 @@ private:
return this;
}
+
+ _LIBCPP_HIDE_FROM_ABI void __try_set_unbuffered_mode() {
+ if (__cm_ == (__no_io_operations | __use_unbuffered_io)) {
+ std::setbuf(__file_, nullptr);
+ __cm_ = 0;
+ }
+ }
+ _LIBCPP_HIDE_FROM_ABI void __try_set_unbuffered_mode(char_type* __s, streamsize __n) {
----------------
ldionne wrote:
```
// If the file is already open, switch to unbuffered mode. Otherwise, record the request
// to use unbuffered mode so that we use that mode when we eventually open the file.
```
Note that we could also name this function `__request_unbuffered_mode`, which may capture better the fact that we're "placing a request" that may be fulfilled later (when we open).
https://github.com/llvm/llvm-project/pull/76629
More information about the libcxx-commits
mailing list