Version 3.2 of the x-kernel maintains reference counts for sessions in
order to facilitate their destruction. The following implementation
notes should guide the protocol writer towards programming techniques
that are consistent with the reference count mechanism.
In v3.1, the XObj structure had a reference count field which
was supposed to keep track of the number of external references to
that object. The intent was that the object could safely be destroyed
when the reference count fell to zero.
Unfortunately, the proper use of reference counts was never
documented. With each protocol writer deciding to handle session
reference counts in a different manner (if at all), reference counts
were seldom accurate. This resulted in idle sessions that were never
freed and in dangling references to sessions which had been destroyed.
Constructing a protocol which directly manipulates reference counts
and does so correctly can be awkward and tedious. Version 3.2 of the
x-kernel has addressed this difficulty by:
The rest of this section discusses the system support for reference
counts and explains how to modify a v3.1 protocol to properly use
reference counts in v3.2.
We discuss XObj reference counts in the context of
sessions (rather than protocols) because protocols are relatively
static objects and the issues surrounding their reference counts are
not very interesting.
Next: References
Up: x-Kernel Programmer's Manual
Previous: Forwarding Control Operations