src/ngx_url_async_fetcher.cc
// This is the read event which is called in the main thread.
// It will do the real work. Add the work event and start the fetch.
This is the read event which is called in the main thread.
It will do the real work. Add the work event and start the fetch.
This is the read event which is called in the main thread . It will do the real work . Add the work event and start the fetch .
void NgxUrlAsyncFetcher::ReadCallback(const ps_event_data& data) {
    std::vector<NgxFetch*> to_start;
    NgxUrlAsyncFetcher* fetcher = reinterpret_cast<NgxUrlAsyncFetcher*>(
      data.sender);
    fetcher->mutex_->Lock();
    fetcher->completed_fetches_.DeleteAll();
    for (Pool<NgxFetch>::iterator p = fetcher->pending_fetches_.begin(),
             e = fetcher->pending_fetches_.end(); p != e; p++) {
      NgxFetch* fetch = *p;
      to_start.push_back(fetch);
    }
    fetcher->pending_fetches_.Clear();
    fetcher->mutex_->Unlock();
    for (size_t i = 0; i < to_start.size(); i++) {
      fetcher->StartFetch(to_start[i]);
    }
    return;
  }
void NgxUrlAsyncFetcher :: ReadCallback ( const ps_event_data & data ) { std :: vector < NgxFetch * > to_start ; NgxUrlAsyncFetcher * fetcher = reinterpret_cast < NgxUrlAsyncFetcher * > ( data . sender ) ; fetcher -> mutex_ -> Lock ( ) ; fetcher -> completed_fetches_ . DeleteAll ( ) ; for ( Pool < NgxFetch > :: iterator p = fetcher -> pending_fetches_ . begin ( ) , e = fetcher -> pending_fetches_ . end ( ) ; p != e ; p ++ ) { NgxFetch * fetch = * p ; to_start . push_back ( fetch ) ; } fetcher -> pending_fetches_ . Clear ( ) ; fetcher -> mutex_ -> Unlock ( ) ; for ( size_t i = 0 ; i < to_start . size ( ) ; i ++ ) { fetcher -> StartFetch ( to_start [ i ] ) ; } return ; }
This is the read event which is called in the main thread.
This is the read event which is called in the main thread .