From b0cfa6cab85ce19c8ecaf9cdd3e34a3593d0b001 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 3 Feb 2011 03:32:32 +0000 Subject: raw_fd_ostream: Add a SetUseAtomicWrites() method (uses writev). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124771 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/raw_ostream.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/llvm/Support/raw_ostream.h') diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 95904ea2f3..6bfae5e298 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -301,6 +301,10 @@ class raw_fd_ostream : public raw_ostream { /// bool Error; + /// Controls whether the stream should attempt to use atomic writes, when + /// possible. + bool UseAtomicWrites; + uint64_t pos; /// write_impl - See raw_ostream::write_impl. @@ -361,6 +365,16 @@ public: /// position to the offset specified from the beginning of the file. uint64_t seek(uint64_t off); + /// SetUseAtomicWrite - Set the stream to attempt to use atomic writes for + /// individual output routines where possible. + /// + /// Note that because raw_ostream's are typically buffered, this flag is only + /// sensible when used on unbuffered streams which will flush their output + /// immediately. + void SetUseAtomicWrites(bool Value) { + UseAtomicWrites = Value; + } + virtual raw_ostream &changeColor(enum Colors colors, bool bold=false, bool bg=false); virtual raw_ostream &resetColor(); -- cgit v1.2.3