[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can we go GTK-only?
From: |
Perry E. Metzger |
Subject: |
Re: Can we go GTK-only? |
Date: |
Tue, 1 Nov 2016 12:41:12 -0400 |
On Tue, 01 Nov 2016 17:11:57 +0200 Eli Zaretskii <address@hidden> wrote:
> > Of course you can call malloc from multiple threads. Otherwise,
> > projects like jemalloc would be pointless. You can freely
> > allocate and deallocate from different threads on both POSIX and
> > Windows systems, and there is no need to free an object on the
> > thread that allocated it.
>
> IMO, this is not a safe assumption, even though in practice more and
> more systems out there provide thread-safe native malloc. Only C11
> mandates that malloc/realloc/free shall be thread-safe, and we don't
> yet require C11.
I was under the impression the requirement that malloc be thread safe
was before now a POSIX/pthreads thing, not a C standard thing, and
that this had been the case for a very long time.
SUS says this explicitly here:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09
2.9.1 Thread-Safety
All functions defined by this volume of POSIX.1-2008 shall be
thread-safe, except that the following functions need not be
thread-safe.
It then goes on to not mention malloc, so malloc is required to be
thread safe.
I can look up old versions of the standard but I believe it was the
case as long as pthreads has been around.
Perry
--
Perry E. Metzger address@hidden
- Re: Can we go GTK-only?, (continued)
- Re: Can we go GTK-only?, Paul Eggert, 2016/11/01
- Re: Can we go GTK-only?, Eli Zaretskii, 2016/11/01
- Re: Can we go GTK-only?, Daniel Colascione, 2016/11/01
- Re: Can we go GTK-only?, Eli Zaretskii, 2016/11/01
- Re: Can we go GTK-only?, Daniel Colascione, 2016/11/01
- Re: Can we go GTK-only?, Perry E. Metzger, 2016/11/01
- Re: Can we go GTK-only?, Lars Ingebrigtsen, 2016/11/01
- Re: Can we go GTK-only?, Eli Zaretskii, 2016/11/01
- Re: Can we go GTK-only?, Paul Eggert, 2016/11/01
- Re: Can we go GTK-only?, Perry E. Metzger, 2016/11/01
Re: Can we go GTK-only?,
Perry E. Metzger <=
- Re: Can we go GTK-only?, Eli Zaretskii, 2016/11/01
- Re: Can we go GTK-only?, Perry E. Metzger, 2016/11/01
- Re: Can we go GTK-only?, Eli Zaretskii, 2016/11/01
- Re: Can we go GTK-only?, Perry E. Metzger, 2016/11/01
- Re: Can we go GTK-only?, Perry E. Metzger, 2016/11/01
Re: Can we go GTK-only?, Daniel Colascione, 2016/11/01