bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthreads library and clone() syscall on Linux


From: Wolfram Gloger
Subject: Re: pthreads library and clone() syscall on Linux
Date: 9 Jan 2003 22:44:00 -0000

> [sent this mail originally to address@hidden". Looks that
>  it not the right list. Hence posting it here. If this is also the 
>  wrong place, please let me know where can I post this query -- thanks]

Probably comp.os.linux.system.development.apps would also fit.

> Are there any issues/problems if a program links with pthreads (i.e.
> compiled with -lpthreads), but does NOT use any of the pthreads_XXX
> functions and uses the clone() glibc function directly.

I'm not aware of any such issues, however compiling/linking with
'-pthreads' (I guess this is what you mean) won't buy you anything.
In particular, libc interfaces such as malloc() will not be
thread-safe with respect to your clone()d threads.  In fact, they
might even crash because pthread_self() might fail for your clone()d
threads, and pthread_self() is used often inside libc when -pthreads
was specified.

> I am wondering whether the init routine of pthreads library (which will
> get called irrespective of pthreads_XXX function being used or not)
> does any setup/initialization that might cause the clone() syscall
> used by the program to misbehave or fail?

No, I cannot imagine how it could cause the clone() syscall to fail.
But again, you may have trouble using libc functions later on.

Regards,
Wolfram.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]