Changeset 22131

Show
Ignore:
Timestamp:
10/26/08 02:43:42 (5 years ago)
Author:
frsyuki
Message:

lang/c/mpio: iothreads::reader call handler::~handler on worker thread

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/c/mpio/trunk/src/iothreads_reader.cc

    r21965 r22131  
    219219 
    220220namespace { 
    221 static void close_delete_handler(int fd, handler* h) { 
     221static void close_fd(int fd) { 
    222222        ::close(fd); 
    223         delete h; 
    224223} 
    225224} 
     
    238237 
    239238void reader::impl::worker::remove_handler(handler* h) 
    240 try { 
    241         m_ev.remove(h->fd(), EV_READ); 
     239{ 
     240        int fd = h->fd(); 
     241        m_ev.remove(fd, EV_READ); 
     242        delete h; 
    242243        //::close(fd);  // FIXME close(2)はロジックスレッドで 
    243244        // 1. fdに対してイベント到着 
     
    246247        // 4. イベントに対して返信するためにsend_data 
    247248        // 5. 期待とは異なるfdに返信されてしまう 
    248         iothreads::submit(close_delete_handler, h->fd(), h); 
    249 } catch (...) { 
    250         ::close(h->fd()); 
    251         delete h; 
     249        try { 
     250                iothreads::submit(close_fd, fd); 
     251        } catch (...) { 
     252                ::close(fd); 
     253        } 
    252254} 
    253255