diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-11-24 23:25:58 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1996-11-24 23:25:58 +0000 |
commit | 7d7f1045fa9f97b6797ddf70b66c7b78aadc1105 (patch) | |
tree | 12679470148b109564cc28a52fa7aeb5732f5b00 /ace/UPIPE_Stream.cpp | |
parent | cfbd608bdcbfb343bb7847830cb8d332fe181d6f (diff) | |
download | ATCD-7d7f1045fa9f97b6797ddf70b66c7b78aadc1105.tar.gz |
Done
Diffstat (limited to 'ace/UPIPE_Stream.cpp')
-rw-r--r-- | ace/UPIPE_Stream.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/ace/UPIPE_Stream.cpp b/ace/UPIPE_Stream.cpp index 3c9bed43494..b4bffcee7ae 100644 --- a/ace/UPIPE_Stream.cpp +++ b/ace/UPIPE_Stream.cpp @@ -13,6 +13,14 @@ ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Stream) +ACE_UPIPE_Stream::ACE_UPIPE_Stream (void) + : remaining_ (0), + reference_count_ (0), + mb_last_ (0) +{ + ACE_TRACE ("ACE_UPIPE_Stream::ACE_UPIPE_STREAM"); +} + int ACE_UPIPE_Stream::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, void * val) @@ -31,14 +39,22 @@ int ACE_UPIPE_Stream::close (void) { ACE_TRACE ("ACE_UPIPE_Stream::close"); - // Since the UPIPE should have been closed earlier we won't bother - // checking to see if closing it now fails. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); - if (this->ACE_SPIPE::get_handle () != ACE_INVALID_HANDLE) - this->ACE_SPIPE::close (); + this->reference_count_--; + + if (this->reference_count_ == 0) + { + // Since the UPIPE should have been closed earlier we won't bother + // checking to see if closing it now fails. - // Close down the ACE_stream. - return this->stream_.close (0); + if (this->ACE_SPIPE::get_handle () != ACE_INVALID_HANDLE) + this->ACE_SPIPE::close (); + + // Close down the ACE_stream. + return this->stream_.close (0); + } + return 0; } int @@ -73,7 +89,6 @@ ACE_UPIPE_Stream::send (const char *buffer, ACE_TRACE ("ACE_UPIPE_Stream::send"); ACE_Message_Block *mb_p; - ACE_NEW_RETURN (mb_p, ACE_Message_Block (n), -1); mb_p->copy (buffer, n); |