diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-06-11 15:05:15 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-06-11 15:05:15 -0400 |
commit | 96714119327ddd6690a90c2ac45cdfe8baba5cc9 (patch) | |
tree | 26ddd330f72203111acba69f757e7dd58de75575 /util/util.cpp | |
parent | d36aae49b1edf89a39327c7a2dc8489d50a67c64 (diff) | |
download | mongo-96714119327ddd6690a90c2ac45cdfe8baba5cc9.tar.gz |
i think this is needed because cout can be unsafe
Revert "Fix warning"
This reverts commit d4cc11852bad2e42fa98a0aaef845934fffe0b35.
Diffstat (limited to 'util/util.cpp')
-rw-r--r-- | util/util.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util/util.cpp b/util/util.cpp index c6471fa0eea..922ca679fe4 100644 --- a/util/util.cpp +++ b/util/util.cpp @@ -141,8 +141,14 @@ void setThreadName(const char *name) char now[64]; time_t_to_String(time(0), now); now[20] = 0; - - std::cout << now << " " << s << std::flush; +#if defined(_WIN32) + (std::cout << now << " " << s).flush(); +#else + write( STDOUT_FILENO, now, 20 ); + write( STDOUT_FILENO, " ", 1 ); + write( STDOUT_FILENO, s.c_str(), s.length() ); + fsync( STDOUT_FILENO ); +#endif } ostream& operator<<( ostream &s, const ThreadSafeString &o ){ |