This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: glibc as a shared object vs. strtok


On Thu, Feb 05, 2009 at 09:24:28PM +0100, "StanisÅaw T. Findeisen" wrote:
>  Hello
> 
>  I am having a question regarding strtok:
> 
>          #include <string.h>
> 
>          char *strtok(char *str, const char *delim);
> 
>  The manual page says it is not thread safe because it uses a static buffer. 
>  The question is: how come this function can be a part of a shared object, 
>  and thus be shared among multiple processes?

Because the operating system garantees process memory separation.
Usually this is implemented with COW (copy-on-write), so that the most
amount of RAM can be shared.

-- 
lfr
0/0

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]