PR_Cleanup hangs

2001-10-23 Thread Mike Oliver

After closing a SSL blocking socket and preparing to shutdown, I call:

 NSS_Shutdown();
 PR_Cleanup();

PR_Cleanup, however, never returns. Any thoughts? Running on Win2K.

Thanks,

Mike Oliver
Invertix






Re: PR_Cleanup hangs

2001-10-23 Thread Wan-Teh Chang

Mike Oliver wrote:

 After closing a SSL blocking socket and preparing to shutdown, I call:
 
  NSS_Shutdown();
  PR_Cleanup();
 
 PR_Cleanup, however, never returns. Any thoughts? Running on Win2K.


It would be nice to use the debugger to see where PR_Cleanup
is waiting.  I suspect that it is waiting for all the user
threads to terminate.

Because of NSPR's past as the underpinnings of Netscape's
port of Sun JVM, NSPR has the notion of user threads and
system threads.  This is the first argument to PR_CreateThread.

If you call PR_Cleanup(), it will wait until all the
threads created as PR_USER_THREAD have terminated.

Wan-Teh






Re: PR_Cleanup hangs

2001-10-23 Thread Mike Oliver

I have two other threads running, but I did not create them using NSPR, but
rather as Win32 ::CreateThread calls. Could this be causing the problem? Any
other thoughts? Would you recommend that I download all the source and step
into PR_Cleanup w/ the debugger?

Thanks for all your help.

Mike Oliver
Invertix

Wan-Teh Chang [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Mike Oliver wrote:

  After closing a SSL blocking socket and preparing to shutdown, I call:
 
   NSS_Shutdown();
   PR_Cleanup();
 
  PR_Cleanup, however, never returns. Any thoughts? Running on Win2K.


 It would be nice to use the debugger to see where PR_Cleanup
 is waiting.  I suspect that it is waiting for all the user
 threads to terminate.

 Because of NSPR's past as the underpinnings of Netscape's
 port of Sun JVM, NSPR has the notion of user threads and
 system threads.  This is the first argument to PR_CreateThread.

 If you call PR_Cleanup(), it will wait until all the
 threads created as PR_USER_THREAD have terminated.

 Wan-Teh








Re: PR_Cleanup hangs

2001-10-23 Thread Wan-Teh Chang

Mike Oliver wrote:

 I have two other threads running, but I did not create them using NSPR, but
 rather as Win32 ::CreateThread calls. Could this be causing the problem? Any
 other thoughts? Would you recommend that I download all the source and step
 into PR_Cleanup w/ the debugger?


If those threads call an NSPR function, they may
be given an NSPR thread ID.  If so, they would
be considered a PR_USER_THREAD and PR_Cleanup
would wait for their termination.  In hindsight,
these attached threads probably should be
considered PR_SYSTEM_THREAD's.

My suggestion is to not call PR_Cleanup().  It
is okay to omit the PR_Cleanup() call.  All the
resources created by NSPR, such as file descriptors
and memory allocated from the heap, are automatically
cleaned up by the OS upon process exit.

Wan-Teh