From: Andreas Voegele <voegelas@gmx.net>
Subject: Re: crypt mutex
Date: Tue, 24 Feb 2004 02:11:48 +0100 [thread overview]
Message-ID: <87vflxwaaz.fsf@ID-28718.user.uni-berlin.de> (raw)
In-Reply-To: <xy7smh1efkk.fsf@chunk.mit.edu> (Mikael Djurfeldt's message of "Mon, 23 Feb 2004 14:55:23 -0500")
Mikael Djurfeldt <mdj@mit.edu> writes:
> Mikael Djurfeldt <mdj@mit.edu> writes:
>
>> Marius Vollmer <mvo@zagadka.de> writes:
>>
>>>> In most cases, I would probably draw the line so that as much as
>>>> possible of the responsibility is left to the user with the
>>>> exceptions that 1. Guile should never segfault due to misuse in
>>>> this respect, and, 2. Guile need to have enough thread safety so
>>>> that it's reasonably convenient to write parallel programs.
>>>
>>> Yes, exactly my view. Also, I would broaden point 1 a bit: we should
>>> also 'fix' functions that can not every be used in a threaded program
>>> without mutexes around them. Like libc getpwent. They might not
>>> segfault, but you can't use them anyway in a threaded program.
>>
>> But the normal case is *not* a threaded program. The everyday program
>> can use crypt with a static buffer without mutexes. A *threaded*
>> program needs mutexes...
>>
>> This is why I'm leaning towards a minimal policy---to design for the
>> common case of non-threaded programs, but leave the possibility open
>> to write parallel code without too much difficulty.
>
> Of course: If you by 'fix' mean making functions reentrant (that is:
> fixes without too much overhead), then I would agree.
I'd also prefer a minimal policy. But what do you do if operating
system A provides the reentrant function foo_r() while operating
system B provides foo() only? The Scheme procedure "foo" should
behave the same on both systems.
I think that there are four options:
1. Use foo_r() if available, otherwise protect foo() with a mutex
internally.
2. Use foo() and tell the user to protect the Scheme procedure in
threaded programs. It doesn't make sense to use foo_r() in this
scenario.
3. Provide two Scheme procedures: "foo" and a thread safe version
"foo-r". "foo-r" uses foo() and a mutex if foo_r() isn't
available.
4. Provide two modules, a normal and a thread safe version. A command
line switch could be used to request thread safety. IMHO this
would be useful for stuff like the POSIX and networking procedures.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-02-24 1:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-21 0:32 crypt mutex Kevin Ryde
2004-02-21 3:24 ` Mikael Djurfeldt
2004-02-21 3:26 ` Mikael Djurfeldt
2004-02-23 19:15 ` Marius Vollmer
2004-02-21 21:50 ` Kevin Ryde
2004-02-23 19:16 ` Marius Vollmer
2004-02-23 19:12 ` Marius Vollmer
2004-02-23 19:46 ` Mikael Djurfeldt
2004-02-23 19:55 ` Mikael Djurfeldt
2004-02-24 1:11 ` Andreas Voegele [this message]
2004-02-24 1:22 ` Mikael Djurfeldt
2004-03-20 22:39 ` Marius Vollmer
2004-03-20 22:51 ` Kevin Ryde
2004-07-23 23:53 ` Kevin Ryde
2004-02-23 20:01 ` Mikael Djurfeldt
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/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vflxwaaz.fsf@ID-28718.user.uni-berlin.de \
--to=voegelas@gmx.net \
/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).