mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-24 01:31:05 +00: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();
|
ThreadSafeStreambuf();
|
||||||
virtual ~ThreadSafeStreambuf();
|
virtual ~ThreadSafeStreambuf();
|
||||||
|
|
||||||
|
virtual std::streamsize xsputn(const char_type *s, std::streamsize count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Not implemented -- not allowed...
|
// Not implemented -- not allowed...
|
||||||
ThreadSafeStreambuf(const ThreadSafeStreambuf &);
|
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 a new issue