Rob Crittenden wrote, On 2008-09-09 20:18:

> Does this mean than an explicit PR_Init() is not required?

Whenever you call a public PR_ function, if NSPR is not already initialized,
it will get initialized by that first call.  (*)

However, NSPR initialization should only be done on one thread.  It's bad
if multiple threads call NSPR Functions that all try to initialize NSPR
simultaneously.

PR_Init exists to provide a way to initialize NSPR at a point in the program
when the programmer is sure that no other thread can possibly be using NSPR.

Note: (*) I'm not sure this is correct for 100% of the public NSPR PR_
functions, but I believe it is true for the vast majority.  It may be that
some functions, such as those that operate on open PRFileDescriptors, may
not initialize NSPR, because they reasonably assume that the functions
that returned those newly opened PRFileDescriptors would have initialized
NSPR.  This is speculation.  Perhaps Wan-Teh will make an authoritative
statement about this.
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to