<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered)">
<title>RE: [Openib-windows] RE: Reference count as a solution to the problemof
an object life time</title>
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>I want to
give an example to this: "I" create an object (and set it's reference
to 1). I give this object to the CM (IB_CM_LISTEN(obj)). The CM wants to do a
call back in the future, so he increases the reference count to 2. Now I forget
about the object and release my reference (back to 1). The CM receives a
request and wants to call my call back. He does this without increasing the
reference. I use the object during the callback. If I want to keep it I
increase the reference count. Now let's say that after 50 callbacks he has some
error. He calls the error callback and releases his reference count since he
doesn't want to use the object any more. The reference went to 0 and the object
is being destroyed (release understands that the reference has reached 0 and
call the destroy automatically). </span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>This seems error prone to me.  If you no longer want an
object and decrement its reference count, you could very well destroy the
associated context.  Getting a callback after this is likely to
crash.  This model seems to increase the complexity for a ULP.  How
can a ULP unload?  How can it signal the CM that it will no longer be
around to receive a callback?  An app that allocates an object can’t
simply forget about it.  Using this method, the creator of the object will
never know if a callback will occur for some past created object, so can never
cleanup anything associated with the object.</span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>- Sean</span></font></p>

</div>

</div>

</body>

</html>