mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-28 03:24:16 +01:00
Add simple implementation of our thread-safe stream buffer.
This commit is contained in:
parent
8bc81edf14
commit
7bd54105e4
@ -63,6 +63,8 @@ class ThreadSafeStreambuf : public ::std::streambuf {
|
||||
ThreadSafeStreambuf();
|
||||
virtual ~ThreadSafeStreambuf();
|
||||
|
||||
virtual std::streamsize xsputn(const char_type *s, std::streamsize count);
|
||||
|
||||
private:
|
||||
// Not implemented -- not allowed...
|
||||
ThreadSafeStreambuf(const ThreadSafeStreambuf &);
|
||||
|
@ -68,4 +68,11 @@ ThreadSafeStreambuf::~ThreadSafeStreambuf() {
|
||||
}
|
||||
}
|
||||
|
||||
::std::streamsize ThreadSafeStreambuf::xsputn(const char_type *s,
|
||||
::std::streamsize count) {
|
||||
// Lock it.
|
||||
TCLock lock(*m_Mutex);
|
||||
// then just do what you would have done...
|
||||
return ::std::streambuf::xsputn(s, count);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user