Thread (4 messages) flat view 4 messages, 4 authors, 2002-01-04

Re: Having linking problems with atomic_inc(), atomic_dec_and_test() in user app, help!

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2002-01-04 12:57:37

quoted
I have what I hope is an easy question for you... I have am writing an
user-space application that does some multithreading (using pthreads), and
does some thread-safe reference counting by using the functions in
asm/atomic.h.  Specifically, I'm using the atomic_inc(atomic_t *) and
atomic_dec_and_test(atomic_t *) functions.
Those are kernel functions, not availble to userland. If your userland
application need them, you have to either re-implement them, or rely on
equivalent routines provided by glibc if any.

If you plan to re-implement them, beware that some CPU-specific errata
have to be taken into account, you probably want to add all the sync's
that are CONFIG-dependant in the kernel in your userland implementation
for it to work properly on all PPC CPUs and on SMP machines.

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help