Monday, September 3, 2007

Version out

After some minor changes, mostly in the documentation area, released as 0.8.0.x, there is a more significant change in, adding a "pointer use policy". A named functor is a very simple object; it is just a wrapper that uses some internal "smart pointer" to reference an object of a more complex type that actually does the job for the named functor. Until now these "smart pointers" were always "shared", using a reference counter; so when a named pointer was assigned to another, they used internally the same copy of the "worker" object.

That is fine until you want to use a copy of a named functor among multiple threads. That may work incorrectly because there is no synchronization of the smart pointer's functions, so the reference counter might be changed by one thread while another is trying to do the same, leaving the counter in an inconsistent state. Another potential issue was that the same sharing policy was used for user-created functors derived from QuickFunctor's FBase; this becomes an issue when these classes have modifiable state and non-const methods. If a single "worker" object is used that is shared by two named functors, changing one of the named functors will effectively cause the other one to change too.

Well, now the "shared pointers" are still used by default, but there's a choice to use "cloned pointers". They create copies of the "worker" objects when calling constructors or assignments.

It is also possible for users to provide their own implementations for smart pointers, which can be used along with the predefined ones.

For more details see the main project page at SourceForge
FREE hit counter and Internet traffic statistics from