OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Jonas Blunck TACMa (jobuTAC.SE)
Date: Wed Feb 06 2002 - 07:30:59 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Yes, since you AddRef'ed it before returning it to the client, the reference
    count will hit zero only when the client call Release.

    // B

    -----Original Message-----
    From: Pete Davis [mailto:pdavisQUETEL.COM]
    Sent: den 6 februari 2002 14:33
    To: DCOMDISCUSS.MICROSOFT.COM
    Subject: Re: Page Swapping

    Actually, this is exactly what we do, but can we do a
    pLocalRecordset->Release() without releasing **ppRecSet?

    Pete
    ----- Original Message -----
    From: "Jonas Blunck TACMa" <jobuTAC.SE>
    To: <DCOMDISCUSS.MICROSOFT.COM>
    Sent: Wednesday, February 06, 2002 8:26 AM
    Subject: Re: Page Swapping

    > What about doing this:
    >
    > HRESULT Amethod(Idispatch** ppRecSet)
    > {
    > *ppRecSet = pLocalRecordset; // ado recordset
    > (*ppRecSet)->AddRef();
    >
    > return S_OK;
    > }
    >
    > The recordset is AddRef'ed and can be released when the client is done
    with
    > it. This also confirms with the COM reference couting rules, which
    > effectively state that out-parameters should be AddRef'ed.
    >
    > // B
    >
    >
    > -----Original Message-----
    > From: Pete Davis [mailto:pdavisQUETEL.COM]
    > Sent: den 6 februari 2002 14:27
    > To: DCOMDISCUSS.MICROSOFT.COM
    > Subject: Re: Page Swapping
    >
    >
    > Okay, it works something like this:
    >
    > HRESULT AMethod(/*[out]*/ IDispatch **ppRecSet)
    > {
    > ...
    > Get an ADO recordset
    > ...
    >
    > *ppRecSet = (IDispatch*) pLocalRecordset;
    >
    > return S_OK
    > }
    >
    > Okay, at the time when we execute return S_OK, the pLocalRecordset
    > needs
    to
    > have a reference count of 1, otherwise the client will receive an
    > invalid recordset.
    >
    > So, there's no way, at ths point, to release pLocalRecordset. So
    > instead, before calling return S_OK, we add pLocalRecordset to our
    > garbage
    collection
    > list. The next time AMethod is called, the first thing we do is go
    > through the list and release any recordsets that are more than 2
    > minutes old.
    >
    > Does that make sense?
    >
    > Pete
    >
    > ----- Original Message -----
    > From: "Jonas Blunck TACMa" <jobuTAC.SE>
    > To: <DCOMDISCUSS.MICROSOFT.COM>
    > Sent: Wednesday, February 06, 2002 8:09 AM
    > Subject: Re: Page Swapping
    >
    > [snip]
    > Had to delete the rest as the message got bounced for being too long.
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html . To unsubscribe,
    > mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html . To unsubscribe,
    > mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
    >

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html . To unsubscribe,
    mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM