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/include stdio.h src/lib/libc/gen _pthread_stubs.c src/lib/libc/stdio _flock_stub.c asprintf.c findfp.c fseek.c local.h refill.c snprintf.c sprintf.c sscanf.c ungetc.c vasprintf.c vfprintf.c vsnprintf.c vsprintf.c vsscanf.c


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Mon, 9 May 2005 16:42:31 +0200
Mail-followup-to: commits@crater.dragonflybsd.org

On Mon, May 09, 2005 at 09:37:16PM +0800, davidxu wrote:
> >Why can't this code use PTHREAD_MUTEX_RECURSIVE?
> >
> >Joerg
> 
> Hmm, we don't create mutex at same time when FILE is created,
> it will be created automatically by pthread_mutex_lock when
> program is threaded, it is zero cost if program is single thread.

Well, for a truely single threaded program (not linked against libc_r
or others), we can use __isthreaded to skip it. Otherwise we have to
use a mutex anyway. Such optimisations belong IMO into the thread
library and not into libc.

Joerg



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