[ 
https://issues.apache.org/jira/browse/LOGCXX-394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13903605#comment-13903605
 ] 

Rhys Ulerich commented on LOGCXX-394:
-------------------------------------

You make a good point re: the equality checks.  Two things:

First, I don't understand the comparison overrides for LevelPtr in r1568810.  
Neither does GCC:

log4cxx/src/main/include/log4cxx/level.h:279:14: error: specializing member 
‘log4cxx::helpers::ObjectPtrT<log4cxx::Level>::operator==’ requires 
‘template<>’ syntax
  inline bool LevelPtr::operator==(const LevelPtr& rhs) const

Second, I'm not sure how to just add in magic behavior for LevelPtr::operator== 
since LevelPtr is an ObjectPtrT and ObjectPtrT::operator== is non-virtual.  Is 
there some better virtual function pattern that could be used so that LevelPtr 
automatically adopts the semantics of Level?  Or should it at all adopt the 
semantics of Level equality and instead simply behave like an ObjectPtr?

Thanks for digging into this one,
Rhys

> Levels are not thread safe
> --------------------------
>
>                 Key: LOGCXX-394
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-394
>             Project: Log4cxx
>          Issue Type: Bug
>          Components: Appender
>         Environment: Windows 7, Visual Studio 2010 SP1
>            Reporter: Petro Protsyk
>            Assignee: Thorsten Schöning
>            Priority: Minor
>              Labels: thread-safety
>
> Level.cpp. All default level variables are function static. This is not 
> thread safe, especially in Visual C++ compiler.
> Here is code to reproduce the issue in VC++ 2010:
>     Concurrency::parallel_for (int(0), int(10), [&](int i) 
>     { 
>         if (::log4cxx::Level::getWarn() == NULL) 
>         { 
>             throw std::exception(); 
>         } 
>      }); 



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to