LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jaf <jaf@lcsaudio.com>
To: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>
Cc: linuxppc-dev@lists.linuxppc.org,
	linuxppc-user@lists.linuxppc.org, jeffk@jdkoftinoff.com
Subject: Re: Having linking problems with atomic_inc(), atomic_dec_and_test() in user app, help!
Date: Fri, 04 Jan 2002 09:00:56 -0800 (PST)	[thread overview]
Message-ID: <60823947811-BeMail@sugoi> (raw)


Hi Michael,

>> Also, what does "relocation truncated to fit: R_PPC_REL24
atomic_inc(atomic_t
>> *)" mean?
>
>About as much as 'unresolved external reference'. atomic_inc isn't
defined
>in the scope of your code. Look at the kernel headers; it might be
inside
>#ifdef __KRENEL__ (actually it is).

I see... when I wrote the code using Red Hat, this was not the case.  I
assumed
things would be similar under all Linuxes... apparently a bad
assumption.

>Why do you think you need to use atomic_inc directly instead of some
>pthreads wrapper?

I wasn't able to find a decent equivalent to atomic_t in the pthreads
API.
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?  :^(

Jeremy

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

             reply	other threads:[~2002-01-04 17:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-04 17:00 jaf [this message]
2002-01-04 17:44 ` Having linking problems with atomic_inc(), atomic_dec_and_test() in user app, help! Michael Schmitz
2002-01-04 19:04   ` Tom Rini
2002-01-04 19:50   ` Having linking problems with atomic_inc(), atomic_dec_and_test()in " Frank Rowand
2002-01-04 19:52     ` Michael Schmitz
2002-01-04 18:33 ` Having linking problems with atomic_inc(), atomic_dec_and_test() in " Kevin B. Hendricks
2002-01-04 18:57   ` Kevin B. Hendricks
  -- strict thread matches above, loose matches on Subject: below --
2002-01-04  3:24 Jeremy Friesner
2002-01-04 11:46 ` Jerry Van Baren
2002-01-04 12:57   ` Benjamin Herrenschmidt
2002-01-04 14:18 ` Michael Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60823947811-BeMail@sugoi \
    --to=jaf@lcsaudio.com \
    --cc=jeffk@jdkoftinoff.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=linuxppc-user@lists.linuxppc.org \
    --cc=schmitz@opal.biophys.uni-duesseldorf.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox