mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: [PATCH] a new lock algorithm with lock value and CS counts in the same atomic int
Date: Sun, 18 Jun 2017 18:05:55 +0300 (MSK)	[thread overview]
Message-ID: <alpine.LNX.2.20.13.1706181759000.21867@monopod.intra.ispras.ru> (raw)
In-Reply-To: <20170618145339.GU1627@brightrain.aerifal.cx>

On Sun, 18 Jun 2017, Rich Felker wrote:
> > I suggest dropping this and spelling 'INT_MIN + current' as 'current - 1 -
> > INT_MAX' below.  (all you need is that INT_MIN <= -INT_MAX)
> 
> I think this can be dropped entirely for musl's purposes and
> essentially for all practical purposes.

In any case, the second half of that suggestion stands: using INT_MAX
consistently everywhere should be better for clarity.

> > > +				__syscall(SYS_futex, l, FUTEX_WAIT|FUTEX_PRIVATE, current, 0) != -ENOSYS
> > > +					|| __syscall(SYS_futex, l, FUTEX_WAIT, current, 0);
> > 
> > It's probably better to put this into a new static inline function in
> > pthread_impl.h next to __wake (e.g. __futexwait) and use it here and in __wait.
> 
> Is there a reason __wait doesn't work?

__wait doesn't fit here at all, for instance it manipulates a separate int with
waiters count.

Alexander


  reply	other threads:[~2017-06-18 15:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16  7:11 Jens Gustedt
2017-06-18 10:01 ` Alexander Monakov
2017-06-18 11:10   ` Jens Gustedt
2017-06-18 11:49     ` Alexander Monakov
2017-06-18 14:45       ` Rich Felker
2017-06-18 14:58         ` Alexander Monakov
2017-06-18 13:40 ` Alexander Monakov
2017-06-18 14:53   ` Rich Felker
2017-06-18 15:05     ` Alexander Monakov [this message]
2017-06-18 16:04       ` Rich Felker
2017-06-18 17:31         ` Jens Gustedt
2017-06-18 19:32         ` Jens Gustedt
2017-06-18 20:20           ` Rich Felker
2017-06-18 20:38             ` Alexander Monakov
2017-06-18 17:40     ` Jens Gustedt
2017-06-18 15:01 ` Rich Felker

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=alpine.LNX.2.20.13.1706181759000.21867@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).