This appears to be the implementation: http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/drand48.c
In that code, it looks to me like nrand48() locks the mutex and then calls _nrand48_u(), an internal function. The _nrand48_u() function saves the global data, copies the caller-supplied data into the global shared buffer, calls _lrand48_u (an internal implementation of lrand48() that doesn't lock the mutex), restores the global data, and returns to the nrand48() function that you called. The nrand48 function then releases the mutex and returns. I'd opine that the implementation leaves a little something to be desired. A much better implementation that would probably be even simpler would be to reverse the function wrapping - an lrand48() that uses the mutex should pass the global buffer to an nrand48() that would not need a mutex. That would at least scale in a multithreaded app. This message posted from opensolaris.org _______________________________________________ perf-discuss mailing list perf-discuss@opensolaris.org