Re: [Boost-bugs] [Boost C++ Libraries] #8348: asio::detail::epoll_reactor::descriptor_state c'tor doesn't initialize all POD members

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8348: asio::detail::epoll_reactor::descriptor_state c'tor doesn't initialize all POD members
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-24 12:20:52


#8348: asio::detail::epoll_reactor::descriptor_state c'tor doesn't initialize all
POD members
----------------------------------------------+-----------------------------
  Reporter: Richard <legalize@…> | Owner: chris_kohlhoff
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: asio
   Version: Boost 1.52.0 | Severity: Cosmetic
Resolution: | Keywords:
----------------------------------------------+-----------------------------

Comment (by Richard <legalize@…>):

 ok. It seems a little odd that we rely on the code that constructs these
 objects to properly initialize them, as that is usually the responsibility
 of the constructor of the object.

 I have another question.

 In epoll_reactor.ipp:

 {{{
 int epoll_reactor::register_descriptor(socket_type descriptor,
     epoll_reactor::per_descriptor_data& descriptor_data)
 {
   descriptor_data = allocate_descriptor_state();

   {
     mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);

     descriptor_data->reactor_ = this;
     descriptor_data->descriptor_ = descriptor;
     descriptor_data->shutdown_ = false;
   }

   epoll_event ev = { 0, { 0 } };
   ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET;
   descriptor_data->registered_events_ = ev.events;
   ev.data.ptr = descriptor_data;
   int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
   if (result != 0)
     return errno;

   return 0;
 }
 }}}

 Why are all the other members set inside the scope of the lock, but
 registered_events_ is modified outside the scope of the lock?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8348#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC