@@ -3134,14 +3134,36 @@ ACE_OS::lwp_setparams (const ACE_Sched_Params &sched_params)
31343134#if defined ACE_HAS_THREADS && defined ACE_LACKS_RWLOCK_T
31353135namespace {
31363136struct UniqueName {
3137- explicit UniqueName (const void *addr)
3137+ UniqueName (int type, const void *addr)
31383138 {
3139+ #ifdef ACE_WIN32
3140+ if (type == USYNC_THREAD)
3141+ {
3142+ this ->named_ = false ;
3143+ return ;
3144+ }
3145+ this ->named_ = true ;
3146+ #else
3147+ ACE_UNUSED_ARG (type);
3148+ #endif
31393149 ACE_OS::unique_name (addr, &this ->buffer_ [0 ], ACE_UNIQUE_NAME_LEN);
31403150 }
31413151
3142- operator const ACE_TCHAR * () const { return &this ->buffer_ [0 ]; }
3152+ operator const ACE_TCHAR * () const
3153+ {
3154+ #ifdef ACE_WIN32
3155+ if (!this ->named_ )
3156+ {
3157+ return 0 ;
3158+ }
3159+ #endif
3160+ return &this ->buffer_ [0 ];
3161+ }
31433162
31443163 ACE_TCHAR buffer_[ACE_UNIQUE_NAME_LEN];
3164+ #ifdef ACE_WIN32
3165+ bool named_;
3166+ #endif
31453167};
31463168
31473169enum RWLockCleanup {RWLC_CondAttr, RWLC_Lock, RWLC_CondReaders, RWLC_CondWriters};
@@ -3196,23 +3218,24 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
31963218
31973219 RWLockCleaner cleanup (attributes, rw);
31983220
3199- if (ACE_OS::mutex_init (&rw->lock_ , type, UniqueName (&rw->lock_ ),
3221+ if (ACE_OS::mutex_init (&rw->lock_ , type, UniqueName (type, &rw->lock_ ),
32003222 (ACE_mutexattr_t *) arg) != 0 )
32013223 return -1 ;
32023224
32033225 cleanup.state_ = RWLC_Lock;
32043226 if (ACE_OS::cond_init (&rw->waiting_readers_ , attributes,
3205- UniqueName (&rw->waiting_readers_ ), arg) != 0 )
3227+ UniqueName (type, &rw->waiting_readers_ ), arg) != 0 )
32063228 return -1 ;
32073229
32083230 cleanup.state_ = RWLC_CondReaders;
32093231 if (ACE_OS::cond_init (&rw->waiting_writers_ , attributes,
3210- UniqueName (&rw->waiting_writers_ ), arg) != 0 )
3232+ UniqueName (type, &rw->waiting_writers_ ), arg) != 0 )
32113233 return -1 ;
32123234
32133235 cleanup.state_ = RWLC_CondWriters;
32143236 if (ACE_OS::cond_init (&rw->waiting_important_writer_ , attributes,
3215- UniqueName (&rw->waiting_important_writer_ ), arg) != 0 )
3237+ UniqueName (type, &rw->waiting_important_writer_ ),
3238+ arg) != 0 )
32163239 return -1 ;
32173240
32183241 cleanup.state_ = RWLC_CondAttr;
0 commit comments