diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-09-07 11:19:34 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-09-07 11:19:34 -0400 |
commit | c9c426efd3e579d0220fbdee4a0a261fa2c191b5 (patch) | |
tree | d67c6356bfda2700e983586afaa71f28734c2cc9 /cpp/src/Ice/ImplicitContextI.cpp | |
parent | Undo pragma-once-in-header enhancement (diff) | |
download | ice-c9c426efd3e579d0220fbdee4a0a261fa2c191b5.tar.bz2 ice-c9c426efd3e579d0220fbdee4a0a261fa2c191b5.tar.xz ice-c9c426efd3e579d0220fbdee4a0a261fa2c191b5.zip |
Port to Solaris 11 / Solaris Studio 12.3 (== CC 5.12)
Fix to BasicStream.h (unitialized data member) that caused occasional failures in Ice/stream test
Diffstat (limited to 'cpp/src/Ice/ImplicitContextI.cpp')
-rw-r--r-- | cpp/src/Ice/ImplicitContextI.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp index 9da2940ff6c..86118533e67 100644 --- a/cpp/src/Ice/ImplicitContextI.cpp +++ b/cpp/src/Ice/ImplicitContextI.cpp @@ -55,9 +55,6 @@ public: virtual void write(const Context&, ::IceInternal::BasicStream*) const; virtual void combine(const Context&, Context&) const; - - static void threadDestructor(void*); - struct Slot { @@ -104,6 +101,9 @@ private: #endif } +extern "C" void iceImplicitContextThreadDestructor(void*); + + /*static*/ ImplicitContextI* ImplicitContextI::create(const std::string& kind) @@ -141,8 +141,7 @@ ImplicitContextI::cleanupThread() { if(PerThreadImplicitContext::_nextId > 0) { - PerThreadImplicitContext::threadDestructor( - TlsGetValue(PerThreadImplicitContext::_key)); + iceImplicitContextThreadDestructor(TlsGetValue(PerThreadImplicitContext::_key)); } } #endif @@ -310,7 +309,7 @@ PerThreadImplicitContext::PerThreadImplicitContext() throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } # else - int err = pthread_key_create(&_key, &threadDestructor); + int err = pthread_key_create(&_key, &iceImplicitContextThreadDestructor); if(err != 0) { throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, err); @@ -351,26 +350,6 @@ PerThreadImplicitContext::~PerThreadImplicitContext() } } -/*static*/ void -PerThreadImplicitContext::threadDestructor(void* v) -{ - SlotVector* sv = static_cast<SlotVector*>(v); - if(sv != 0) - { - // - // Cleanup each slot - // - for(SlotVector::iterator p = sv->begin(); p != sv->end(); ++p) - { - delete p->context; - } - // - // Then the vector - // - delete sv; - } -} - Context* PerThreadImplicitContext::getThreadContext(bool allocate) const { @@ -635,4 +614,24 @@ PerThreadImplicitContext::combine(const Context& proxyCtx, Context& ctx) const ctx.insert(threadCtx->begin(), threadCtx->end()); } } + +extern "C" void iceImplicitContextThreadDestructor(void* v) +{ + PerThreadImplicitContext::SlotVector* sv = static_cast<PerThreadImplicitContext::SlotVector*>(v); + if(sv != 0) + { + // + // Cleanup each slot + // + for(PerThreadImplicitContext::SlotVector::iterator p = sv->begin(); p != sv->end(); ++p) + { + delete p->context; + } + // + // Then the vector + // + delete sv; + } +} + #endif |