Next: Reference counts Up: Reference Counting XObjs Previous: Reference Counting XObjs

References

An XObj reference is a pointer to an XObj. References come in two flavors: permanent and temporary.

A permanent reference can be used indefinitely. As long as the holder of a permanent reference does not call xClose on the reference, the holder knows that the pointer will remain valid. Permanent references are returned by xOpen.

An XObj pointer received as a parameter in a function call is a temporary reference. It can only be safely used for the duration of that function call.

A permanent reference may be created from a temporary reference by using the UPI function xDuplicate. For example, xDemux passes a reference to the lower session as a parameter to the upper protocol. If the upper protocol wishes to save this reference beyond the extent of the demux call, the protocol should call xDuplicate on the session. The protocol can then safely use the reference until it calls xClose.


Tue Nov 29 16:28:56 MST 1994