summaryrefslogtreecommitdiff
path: root/src/file.hh
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2024-11-24 10:19:32 +0100
committerMaxime Coste <mawww@kakoune.org>2024-12-09 22:23:35 +1100
commit7105584538f84d1c244809601fd3e573e8d6080c (patch)
treeca1e38b5fb7fd6862fb917212af817e3328f1412 /src/file.hh
parent816a8c35a8cfa0cc8b7f9d80dd3c0e721ba3c273 (diff)
Print elapsed time when blocked on opening file for writing
Extract the logic for "waiting for shell to finish" and reuse it for potentially blocking calls to open() that use the O_WRONLY flags.
Diffstat (limited to 'src/file.hh')
-rw-r--r--src/file.hh5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/file.hh b/src/file.hh
index ead88c43..a0b55e56 100644
--- a/src/file.hh
+++ b/src/file.hh
@@ -42,7 +42,8 @@ String read_fd(int fd, bool text = false);
String read_file(StringView filename, bool text = false);
template<bool force_blocking = false>
void write(int fd, StringView data);
-void write_to_file(StringView filename, StringView data);
+class Context;
+void write_to_file(const Context&, StringView filename, StringView data);
struct MappedFile
{
@@ -76,7 +77,7 @@ enum class WriteFlags
};
constexpr bool with_bit_ops(Meta::Type<WriteFlags>) { return true; }
-void write_buffer_to_file(Buffer& buffer, StringView filename,
+void write_buffer_to_file(const Context& context, Buffer& buffer, StringView filename,
WriteMethod method, WriteFlags flags);
void write_buffer_to_fd(Buffer& buffer, int fd);
void write_buffer_to_backup_file(Buffer& buffer);