From: "H.J. Lu" <hjl.tools@gmail.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: Use adaptive mutex with std::mutex
Date: Tue, 18 Apr 2023 14:37:02 -0700 [thread overview]
Message-ID: <CAMe9rOr_xfcsrx4jyMZDKiZf_OrA8J5v177+1zSGBSxURG5iSg@mail.gmail.com> (raw)
Hi,
Adaptive mutex works much better than normal mutex on machines with many cores.
However PTHREAD_MUTEX_ADAPTIVE_NP is a GNU extension and not supported
by std::mutex. Is there a way to use adaptive mutex with std::mutex? Glibc has
#define PTHREAD_MUTEX_INITIALIZER \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_TIMED_NP) } }
#ifdef __USE_GNU
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
#endif
Can we add a macro to conditonally define PTHREAD_MUTEX_INITIALIZER with
PTHREAD_MUTEX_ADAPTIVE_NP?
--
H.J.
next reply other threads:[~2023-04-18 21:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 21:37 H.J. Lu [this message]
2023-04-19 20:16 ` Noah Goldstein
2023-04-29 15:34 ` Cristian Rodríguez
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=CAMe9rOr_xfcsrx4jyMZDKiZf_OrA8J5v177+1zSGBSxURG5iSg@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).