Having linking problems with atomic_inc(), atomic_dec_and_test() in user app, help!
jaf at lcsaudio.com
Sat Jan 5 04:00:56 EST 2002
>> Also, what does "relocation truncated to fit: R_PPC_REL24
>> *)" mean?
>About as much as 'unresolved external reference'. atomic_inc isn't
>in the scope of your code. Look at the kernel headers; it might be
>#ifdef __KRENEL__ (actually it is).
I see... when I wrote the code using Red Hat, this was not the case. I
things would be similar under all Linuxes... apparently a bad
>Why do you think you need to use atomic_inc directly instead of some
I wasn't able to find a decent equivalent to atomic_t in the pthreads
The closest thing I could see would be to wrap my counter increments/
decrements in a pthread_mutex_t to serialize them, but creating a
separate mutex for each atomic counter seems a bit expensive/
inefficient, considering there may be thousands of such atomic counters
active at once. Is there some other way to use pthreads to get an
atomic counter? Or is a pthread_mutex_t really efficient enough to
make a decent atomic counter out of? Or do I need to redesign how my
application works, because there is no good way to do a cheap, portable
user-land atomic counter under Linux? :^(
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev