From: Brad Pepers <brad@linuxcanada.com>
To: dipankar@in.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Multi-threading
Date: Mon, 11 Mar 2002 16:53:45 -0700 [thread overview]
Message-ID: <20020311235442Z310204-890+125062@vger.kernel.org> (raw)
In-Reply-To: <20020312010618.A32259@in.ibm.com>
In-Reply-To: <20020312010618.A32259@in.ibm.com>
On Monday 11 March 2002 12:36, Dipankar Sarma wrote:
> In article <20020311182111Z310364-889+120750@vger.kernel.org> Brad Pepers
wrote:
> > There was a message posted by Jim Starkey about his experiences using
> > threads on Linux and the problems debugging them. It came down to two
> > things:
> >
> > 2. Linux is missing an atomic use-count mechanism which returns values
> > like the Microsoft InterlockedIncrement/Decrement functions do.
>
> Can't this be done using atomic_dec_and_test() and the likes ?
> Google tells me that windoze InterlockedIncrement/Decrement stuff
> does the almost same thing. Why can't refcounting be
> implemented using just atomic_inc/dec and/or atomic_inc/dec_and_test ?
The atomic_dec_and_test certainly handles the most often used case and is
good enough. Apparently it would be nice to have the value back sometimes
too though.
The atomic_inc_and_test is not much good though since the case you most often
want to track is the 0 to 1 transition and not -1 to 0!
--
Brad Pepers
brad@linuxcanada.com
next prev parent reply other threads:[~2002-03-11 23:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-11 19:36 Multi-threading Dipankar Sarma
2002-03-11 23:53 ` Brad Pepers [this message]
[not found] <20020311182111Z310364-889+120750@vger.kernel.org.suse.lists.linux.kernel>
2002-03-11 21:54 ` Multi-threading Andi Kleen
2002-03-12 0:02 ` Multi-threading Brad Pepers
[not found] ` <20020312000310.DBCF41EDB9@Cantor.suse.de>
2002-03-12 7:10 ` Multi-threading Andi Kleen
2002-03-13 7:51 ` Multi-threading David Schwartz
2002-03-13 8:23 ` Multi-threading Andi Kleen
2002-03-13 9:01 ` Multi-threading David Schwartz
2002-03-14 4:50 ` Multi-threading Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2002-03-11 18:20 Multi-threading Brad Pepers
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=20020311235442Z310204-890+125062@vger.kernel.org \
--to=brad@linuxcanada.com \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®