libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
set_ostream.inl.h
1// SPDX-FileCopyrightText: 2002-2004, 2018-2020, 2026 Carlo Wood
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#ifndef LIBCWD_SET_OSTREAM_INL
7#define LIBCWD_SET_OSTREAM_INL
8
10
11namespace libcwd {
12
36template <class T>
37void DebugObject::set_ostream(std::ostream* os, T* mutex)
38{
39 _private_::LockInterfaceBase* new_mutex = new _private_::LockInterface<T>(mutex);
40 _private_::LockInterfaceBase* old_mutex;
41 old_mutex = ostream_state_.replace_with(os, new_mutex);
42 // Delete old_mutex after unlocking in order to avoid a dead lock in case the delete causes debug output.
43 if (old_mutex)
44 delete old_mutex;
45}
46
47} // namespace libcwd
48
49#endif // LIBCWD_SET_OSTREAM_INL
void set_ostream(std::ostream *os)
Set output device (single threaded applications).
Definition debug.cxx:1601
namespace for libcwd.