From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Ken Raeburn <raeburn@raeburn.org>
Cc: Eli Zaretskii <eliz@gnu.org>, Ryan Yeske <rcyeske@gmail.com>,
emacs-devel@gnu.org
Subject: Re: problems building trunk in OpenBSD/i386
Date: Fri, 20 Jul 2007 08:43:17 +0200 [thread overview]
Message-ID: <46A05985.2050103@swipnet.se> (raw)
In-Reply-To: <260A0E9D-5A08-4B83-B953-62AF69323093@raeburn.org>
Ken Raeburn skrev:
> On Jul 13, 2007, at 3:23, Jan Djärv wrote:
>> Ken Raeburn skrev:
>>> The other parts of the stack trace indicate that the rest of the loop
>>> is in the C library -- pthread_once calls pthread_mutex_lock, which
>>> initializes some thread support code, which is causing some priority
>>> queue code to try to allocate storage, which winds up calling into
>>> gmalloc, which again ensures that initialization has been done by
>>> calling pthread_once.
>>
>> This sounds like a bug in pthread_once.
>
> Which part? I think having it allocate storage is perfectly acceptable,
> though if you're explicitly linking against the thread library it'd
> probably be quicker for stuff that'll always be needed to be allocated
> in static storage. One might argue that internal uses of standard C
> library functions by the system library functions should use specially
> named internal versions of the C library functions so as to prevent
> overriding them, but then you get into questions of where you draw the
> line(s), and what "overriding" is really supposed to do.
I meant the fact that pthread_once tries to initialize stuff twice. After
all, it should only do things once. But I admit that this recursive calling
of pthread_once is not very well specified as how it should behave.
>
>> I think we safely can call malloc_initialize from main itself without
>> thread protection. The protection is from threads created by the file
>> dialog, and they get created when the dialog is first used. So we
>> should be safe.
>
> That sounds like it'll probably work, yes... guess I was looking for a
> too-general solution, suitable for other uses of this gmalloc.c. The
> semantics of some pthread operations and their interactions with the
> language specs are sufficiently vague and subtle[1] that I'd be wary of
> removing any pthread operations, but since malloc_initialize and then
> malloc (with its mutex locking) would be called in the main thread
> before any other threads are created, I think it's probably safe.
Maybe all this hooks and stuff can be removed if we switch to SYNC_INPUT. I
haven't checked all the details.
Jan D.
prev parent reply other threads:[~2007-07-20 6:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-12 9:37 problems building trunk in OpenBSD/i386 Ryan Yeske
2007-07-12 11:07 ` Eli Zaretskii
2007-07-12 17:22 ` Ken Raeburn
2007-07-13 7:23 ` Jan Djärv
2007-07-20 1:18 ` Ken Raeburn
2007-07-20 6:43 ` Jan Djärv [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46A05985.2050103@swipnet.se \
--to=jan.h.d@swipnet.se \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=raeburn@raeburn.org \
--cc=rcyeske@gmail.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.savannah.gnu.org/cgit/emacs.git
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).