a question for http client sample RRS feed

  • Question

  • In the httprequest.h, where is std::bad_alloc exception from? it is from lock constructor? Please clarify.

        // Called when a portion of the entity body has been received.
        IFACEMETHODIMP OnDataAvailable(IXMLHTTPRequest2*, ISequentialStream* stream)
            HRESULT hr = S_OK;

            // We must not propagate exceptions back to IXHR2.
                // Store a reference on the stream so it can be accessed by the task.
                dataStream = stream;

                // The work must be done as fast as possible, and must not block this thread,
                // for example, waiting on another event object.  Here we simply set an event
                // that can be processed by another thread.
                concurrency::critical_section::scoped_lock lock(dataEventLock);
            catch (std::bad_alloc&)
                hr = E_OUTOFMEMORY;
            return hr;

    rob qqq

    Thursday, October 25, 2012 5:59 PM

All replies