[gst-devel] Docs/RFC: GstData

Benjamin Otte in7y118 at public.uni-hamburg.de
Thu Apr 18 02:52:03 CEST 2002

Forgot something:

On Thu, 18 Apr 2002, David I. Lehn wrote:
> > MT safety
> > ---------
> > Manipulating data inside an object is not threadsafe unless otherwise
> > noted.
> > If an object has a reference count of 1 it is assumed that the reference
> > holder is the only user of that object and he may modify it the way he
> > likes.
> > If the reference count is greater than 1, the object may not be modified.
> > If you need to modify it, you have to copy the object and use that copy
> > instead.
> > NB: Object creation and refcounting are threadsafe - or must be
> > implemented that way.
> >
> Are there locks for this?  How do know if someone has called _ref() on
> your object between checking the refcount and accessing the object data?
The idea behind this is that that you may only modify the data if you hold
a reference to it. That way you can be sure that nobody refs or unrefs
when the refcount is one and you hold that reference.
The MT safety is only needed for fields that may be modified if
refcount > 1. The only field that allows this atm is the refcount itself.

You may not ref if you don't hold a reference.
I should probably make that clear because it seems like a fundamental
difference to other stuff on a second look :)

More information about the gstreamer-devel mailing list