All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Carlos O'Donell <carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Peng Haitao <penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>,
	myllynen-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	"Michael Kerrisk (man-pages)"
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: Thread-safety of iconv()
Date: Thu, 18 Sep 2014 23:57:41 -0300	[thread overview]
Message-ID: <ord2as8ggq.fsf@free.home> (raw)
In-Reply-To: <541ADAC1.2090108-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> (Carlos O'Donell's message of "Thu, 18 Sep 2014 09:14:41 -0400")

On Sep 18, 2014, "Carlos O'Donell" <carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> On 09/18/2014 02:50 AM, Peng Haitao wrote:
>> On 09/15/2014 05:32 PM, Marko Myllynen wrote:
>>> This looks a bit unclear, do you think you could clarify iconv(3) and/or
>>> iconv_open(3) a bit in thread-safety regard?

> It is conditionally thread safe :-)

It is MT-Safe, but it assumes callers arrange for mutual exclusion on
the cd object passed as argument.

It is no different from e.g. memset being MT-Safe, in spite of the race
when two threads call memset concurrently, writing to the same buffer.

It's caller's responsibility to avoid such races in both cases.

> Alex, please correct me if I'm wrong, but I think that sums it up.

Yup.  A recent blog post covers this issue (among others) in some
detail:

http://developerblog.redhat.com/2014/09/10/multi-thread-async-signal-and-async-cancel-safety-docs-in-gnu-libc/

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2014-09-19  2:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15  9:32 Thread-safety of iconv() Marko Myllynen
     [not found] ` <5416B235.8020309-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-09-18  6:50   ` Peng Haitao
     [not found]     ` <541A80BD.8050509-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2014-09-18 13:14       ` Carlos O'Donell
     [not found]         ` <541ADAC1.2090108-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-09-19  2:57           ` Alexandre Oliva [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ord2as8ggq.fsf@free.home \
    --to=aoliva-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=carlos-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=myllynen-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=penght-BthXqXjhjHXQFUHtdCDX3A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.