cvs commit: src/lib/libc/gen Makefile.inc errlst.c src/lib/libc/i386/sys cerror.S ptrace.S src/lib/libc/sys Makefile.inc __error.c src/lib/libc_r/sys Makefile.inc uthread_error.c src/lib/libc_r/uthread Makefile.inc ...

Matthew Dillon dillon at apollo.backplane.com
Tue May 3 11:15:55 PDT 2005


:I'm not sure if we can make e.g. strtok simply thread safe by using
:TLS, but I want to use it to get e.g. the resolver fully thread-safe.
:This is also the right time to work on our NSS implementation. Once
:that works, we can move rpc, yp and perhaps even the resolver out of
:libc.
:
:Joerg

    Sure we can:

char *
strtok(char *s, const char *delim)
{
    static char *last;
    
    return strtok_r(s, delim, &last);
}

    To

char *
strtok(char *s, const char *delim)
{
    __thread static char *last;
    
    return strtok_r(s, delim, &last);
}

    Poof.  Thread safe.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Commits mailing list