| Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
One thing I missed in this class is a constructor that takes an int. Without it, member initializations are ugly:
MyClass::MyClass() : myAtomicInt(1) { }
This isn't possible.
Rob
----- Original Message -----
From: Bradley T Hughes <bhughes@xxxxxxxxxxxxx>
To: Philippe <ph.goutier@xxxxxxxxxxxx>
Cc: qt4-preview-feedback@xxxxxxxxxxxxx <qt4-preview-feedback@xxxxxxxxxxxxx>
Sent: Mon Mar 03 02:49:47 2008
Subject: Re: QAtomicInt
Philippe wrote:
> The naming of methods found in QAtomicInt / QAtomicPointer is unusually
> complex for the Qt API. I understand the subbtleties of the various
> methods, but adding on top of this some simpler namings like:
Unfortunately, doing lock-free programming is a complex, and the API Qt
provides needs to be up to the task.
> setValue(int)
For a non-atomic store, you can just use the assignment operator:
QAtomicInt integer;
integer = 5;
> increment()
> decrement()
Are these any different from fetchAndAddOrdered(1) or fetchAndAddOrdered(-1)?
Would you expect them to return the old, new, or no value? We originally
considered increment() and decrement(), but since we couldn't figure out what
the API should be, we opted for ref() and deref() instead for implementing
reference counting. The rest of the API uses the recognized and accepted names
for the various operations.
--
[ signature omitted ]
Message 2 in thread
rob_lefebvre@xxxxxxxxxxx wrote:
> One thing I missed in this class is a constructor that takes an int. Without it, member initializations are ugly:
>
> MyClass::MyClass() : myAtomicInt(1) { }
>
> This isn't possible.
Sure it is :) See
http://doc.trolltech.com/main-snapshot/qatomicint.html#QAtomicInt
(Of course, if that constructor doesn't work for you, let me know *NOW* :D)
--
[ signature omitted ]
Wait... I'm using QBasicAtomicInt. I'm guessing that is incorrect.
Thanks,
Rob
-----Original Message-----
From: Bradley T Hughes [mailto:bhughes@xxxxxxxxxxxxx]
Sent: Monday, March 03, 2008 9:29 AM
To: LEFEBVRE,ROB (A-USA,ex1)
Cc: qt4-preview-feedback@xxxxxxxxxxxxx
Subject: Re: QAtomicInt
rob_lefebvre@xxxxxxxxxxx wrote:
> One thing I missed in this class is a constructor that takes an int. Without it, member initializations are ugly:
>
> MyClass::MyClass() : myAtomicInt(1) { }
>
> This isn't possible.
Sure it is :) See
http://doc.trolltech.com/main-snapshot/qatomicint.html#QAtomicInt
(Of course, if that constructor doesn't work for you, let me know *NOW* :D)
--
[ signature omitted ]
Message 4 in thread
On Monday 03 March 2008 16:20:29 rob_lefebvre@xxxxxxxxxxx wrote: > Wait... I'm using QBasicAtomicInt. ÂI'm guessing that is incorrect. Indeed. QBasicAtomicInt is the same as QAtomicInt with one important difference: it doesn't have constructors or copy operators. It's a private class that you shouldn't use. The only use of QBasicAtomicInt is when you cannot have the constructor run (i.e., static data). -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
rob_lefebvre@xxxxxxxxxxx wrote: > Wait... I'm using QBasicAtomicInt. I'm guessing that is incorrect. Yes, QBasicAtomicInt is something we need internally (we need it to be POD). Just ignore it and use QAtomicInt instead :) -- [ signature omitted ]