Remove obsolete comment

Talking to Ryan Lortie, he thinks my comment doesn't make sense.

So I'm making the getter const.  Note that g_atomic_int_get()
casts that away itself, so we don't need to worry about that
(which kinda makes me uncomfortable actually).
This commit is contained in:
Behdad Esfahbod 2011-04-21 16:55:17 -04:00
parent dcb7026f33
commit 24229eb132
1 changed files with 2 additions and 14 deletions

View File

@ -46,20 +46,8 @@ typedef struct {
inline int dec (void) { return hb_atomic_int_fetch_and_add (ref_count, -1); }
inline void set (int v) { return hb_atomic_int_set (ref_count, v); }
/* XXX
*
* One thing I'm not sure. The following two methods should be declared
* const. However, that assumes that hb_atomic_int_get() is const. I have
* a vague memory hearing from Chris Wilson or Jeff Muizelaar that atomic get
* is implemented as a fetch_and_add(0). In which case it does write to the
* memory, and hence cannot be called on .rodata section. But that's how we
* use it.
*
* If that is indeed the case, then perhaps is_invalid() should do a
* non-protected read of the location.
*/
inline int get (void) { return hb_atomic_int_get (ref_count); }
inline bool is_invalid (void) { return get () == HB_REFERENCE_COUNT_INVALID_VALUE; }
inline int get (void) const { return hb_atomic_int_get (ref_count); }
inline bool is_invalid (void) const { return get () == HB_REFERENCE_COUNT_INVALID_VALUE; }
} hb_reference_count_t;