Is there a way to lock ofstreams with g++ 3.2.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux