New shared pointer
Frerich Raabe
raabe at kde.org
Fri Sep 9 23:59:20 BST 2005
On Friday 09 September 2005 20:52, Thiago Macieira wrote:
> Frerich Raabe wrote:
> >the current shared pointer implementation in KShared/KSharedPtr is a
> > little too simplistic IMHO:
>
> I'm sorry Frerich, but what is your objective for this class? If you plan
> on simply using an automatic pointer, I think it should be renamed and
> not try to do any sharing at all.
I agree that if I'd plan on simply using an automatic pointer, the class
should be renamed and not try to do any sharing at all.
> If you plan on doing sharing, however, I *strongly* recommend you use
> QShared/QSharedData, even if internally, because it's thread-safe and
> atomic, whereas your implementation isn't, or, at least, QAtomic.
I'm not sure whether you saw that in my original mail, but
QSharedData/QSharedDataPointer has exactly the two annoying quirks which I
tried to remove. Regarding thread-safety: that's merely a matter of using
QAtomic instead of an int (and using the qSetPointerSafely function thing for
copying pointers), no? I'd say that's simple to incorporate.
- Frerich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050909/c932f71f/attachment.sig>
More information about the kde-core-devel
mailing list