DragonFly BSD
DragonFly commits List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: 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 ...


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 3 May 2005 11:14:59 -0700 (PDT)

: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@xxxxxxxxxxxxx>



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