> > I have built Parrot on NetBSD with GNU Portable Threads.
> > All (except SKIP) threads.t tests is successful,
> > BUT "interp identity" and "thread - kill".
>
> > Test "interp identity" sleep perpetual after printing ok1 and ok2.
>
> Strange. Actually no PASM thread is started here.

And why GDB show 2 call of pthread_create function and 1 call of
pthread_join on Linux?

> Could you attach a debugger and look, where it hangs?



I abridged test to 3 lines:
    new P4, .ParrotThread
    print "ok\n"
    end
Result is selfsame.

On NetBSD With gth.

### beginning GDB output ###
nick_vm: {93} gdb ./parrot
GNU gdb 5.0nb1
Copyright 2000 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--netbsdelf"...
(gdb) r my.pbc
Starting program: /usr/home/nick/parrotcode/parrot/./parrot my.pbc

Program received signal SIGUSR1, User defined signal 1.
0x48281b77 in __sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program received signal SIGUSR1, User defined signal 1.
0x48281b77 in __sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program received signal SIGUSR1, User defined signal 1.
0x48281b77 in __sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program received signal SIGUSR1, User defined signal 1.
0x48281b77 in __sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program received signal SIGUSR1, User defined signal 1.
0x48281b77 in __sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program received signal SIGUSR1, User defined signal 1.
0x48281b77 in __sigsuspend14 () from /usr/lib/libc.so.12
(gdb) c
Continuing.
ok

### pause GDB output ###

And parrot is sleeping... GDB is also sleeping.

nick_vm: {16} ps
  PID TT STAT    TIME COMMAND
11050 p0 Ss   0:00.99 -tcsh
19899 p0 S    0:00.93 gdb ./parrot
19900 p0 SX+  0:00.11 /usr/home/nick/parrotcode/parrot/./parrot my.pbc
11068 p1 Ss   0:00.29 -tcsh
19902 p1 R+   0:00.04 ps
nick_vm: {17} kill 19900
nick_vm: {18}


### continuation GDB output after sending kill signal to parrot ###

Program received signal SIGTERM, Terminated.
0x48281d6f in select () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program received signal SIGTERM, Terminated.
0x48281d6f in select () from /usr/lib/libc.so.12
(gdb) c
Continuing.

Program terminated with signal SIGTERM, Terminated.
The program no longer exists.
(gdb)

### end GDB output ###

======================================

Honestly speaking, I do understand nothing!
Probably select have been called without timeout.

For purity of experiment I have decided to use mit-pthreads-1.60b6
(ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/devel/mit-pthreads/README.h
tml)
instead gth.

Test 1 use 100% CPU and sleep perpetually :-)

Under gdb parrot falled:

nick_vm: {41} gdb ./parrot
GNU gdb 5.0nb1
Copyright 2000 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--netbsdelf"...
(gdb) run my.pbc
Starting program: /usr/home/nick/parrotcode/parrot/./parrot my.pbc
ok 1
ok 2

Program received signal SIGSEGV, Segmentation fault.
0x48236f29 in pthread_join () from /usr/pkg/pthreads/lib/libpthread.so.1
(gdb)



>
> > Test "thread - kill" running perpetual using 100% CPU.
>
> That's clear. The thread is spinning in this loop:
>
>   lp:
>       noop
>       branch lp
>
> As pth(3) doesn't preempt threads, it runs forever. Please try this:
>
>   lp:
>       sleep 0.1
>       branch lp

It's worked.

Nick.

Reply via email to