Subject: exit() strangeness with pth thread package...
To: None <netbsd-help@netbsd.org>
From: Brian Stark <bstark@siemens-psc.com>
List: netbsd-help
Date: 10/13/2000 15:33:13
Hello,

I am using pth-1.3.7 (GNU Portable Thread library) and exit() won't
exit. I have a small test program that has a main like this:

int main(int argc, char *argv[])
{ 
  pthread_name_test();

  cout << "Program will now exit..." << endl;
  exit(EXIT_SUCCESS);

  return (0);
}

The basic purpose of the program seems to work (it does some testing with
POSIX threads) and pthread_name_test() returns control to main() for
execution. Executing the program produces output like this:

  [... deleted for space ...]
  
  pthread_name_test() end
  Program will now exit...


At this point the program does not exit. Running top on the system shows
that my process is using up about 95% of the CPU.

Using gdb I can attach to the process and it looks like the pth package
has installed an exit handler as it is currently stuck in
pth_mutex_release():

palomino:{root}# gdb simplejob 837 
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386--netbsd"...

/usr/local/s/bin/simplejob/netbsdcpp.plt/837: No such file or directory.
Attaching to program `/usr/local/s/bin/simplejob/netbsdcpp.plt/simplejob',
process 837
Reading symbols from /usr/libexec/ld.elf_so...done.
Reading symbols from /usr/pkg/lib/libpthread.so.13...done.
Reading symbols from /usr/lib/libstdc++.so.2...done.
Reading symbols from /usr/lib/libm387.so.0...done.
Reading symbols from /usr/lib/libm.so.0...done.
Reading symbols from /usr/lib/libc.so.12...done.
0x480b992c in pth_mutex_release ()
(gdb) 

Has anyone else using the pth package seen this type of behaviour before?
In case it matters, this is on a 1.5_ALPHA2/i386 system:

  palomino:{root}# uname -a 
  NetBSD palomino.siemens-psc.com 1.5_ALPHA2 NetBSD 1.5_ALPHA2
  (PALOMINO) #6: Thu Aug 31 15:55:12 CDT 2000
  bstark@palomino.siemens-psc.com:/usr/src/sys/arch/i386/compile/PALOMINO
  i386
  palomino:{root}# 


Brian

-------------------------------------------------------------------------
| Brian Stark  Siemens Power Transmission & Distribution, Inc.          |
|              Energy Management and Information Systems Division       |
|              7225 Northland Drive, Brooklyn Park, Minnesota 55428 USA |
| email: bstark@siemens-psc.com +1 763 536-4697 fax: +1 763 536-4919    |
-------------------------------------------------------------------------