Hello...
We have recently ported our apps from Solaris to Linux and are now using
g++ 3.2.1. One of our libraries provided a stream interface for consistent
logging, etc. It had stream manipulators for locking and unlocking the log
stream. This was especially useful when the log files needed to wrap due
to size. They were tied to the underlying stream locking that existed in
the Solaris C++ libraries so that even callers who didn't correctly lock
and unlock the streams got some benefit as far as not being corrupted if
the log file was wrapped by another thread in the middle of their log.
Now, with g++ 3.2.1, I can't seem to determine the best way to tie into the
existing stream locking. I'm assuming that there must be some, and I do
see the protected _M_lock in the basic_filebuf. I supposed I could derive
my own filebuf from that and lock and unlock it when needed, but I was
hoping that I was missing the "normal" way that something like this is done
for this version of iostreams.
Thanks for any guidance you can give...
Heath
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.