Re: clone() + glibc thread safe?

From: Arjan van de Ven
Date: Thu Jan 12 2006 - 02:27:11 EST


On Wed, 2006-01-11 at 20:40 -0500, Russell Leighton wrote:
> Can you safely use glibc functions in a thread safe way (e.g., malloc()
> and friends) from threads generated by:
>
> clone(f, stack, CLONE_FS|CLONE_FILES|CLONE_VM, t)

no

unless you tell glibc you're using threads (by using the glibc threading
primitives) glibc doesn't provide such thread safety.
(glibc at runtime knows you have threads and switches to thread-safe
operations)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/