On Jan 5, 2004, at 5:32 AM, Leopold Toetsch wrote:


Jeff Clites <[EMAIL PROTECTED]> wrote:
If I run this code, which should just be a loop which
creates-then-joins a thread (looping twice), I get a crash at the end:

The problem is that when joining the _second_ time, in pt_thread_join()
you get a return value from joining the thread

The return value is only returned, when I3 != 0. For your example that
shouldn't be the case (I3 is unused aka zero). So there isn't any return
value passed back.

Yep, the second time through I find REG_INT(3) (that is, interpreter->int_reg.registers[3]) set to 1 in thread_func().


Are you running the latest source? It doesn't crash here.

Yep, I just verified, using a clean checkout and build:


% gdb parrot
...
(gdb) b src/thread.c:238
Breakpoint 1 at 0xf890c: file src/thread.c, line 238.
(gdb) r thrspeed.pasm
Starting program: /Users/jac/Projects/parrot/parrot-thread-join-crash/parrot thrspeed.pasm
Reading symbols for shared libraries . done


Breakpoint 1, pt_thread_join (parent=0x1000200, tid=1) at src/thread.c:238
238 if (retval) {
(gdb) p retval
$1 = (void *) 0x0
(gdb) c
Continuing.


Breakpoint 1, pt_thread_join (parent=0x1000200, tid=1) at src/thread.c:238
238 if (retval) {
(gdb) p retval
$2 = (void *) 0x10163d0
(gdb) p (char*)((PMC*)retval)->vtable->isa_str->strstart
$3 = 0x1da410 "ParrotThread ParrotInterpreter"
(gdb) c
Continuing.
done


Program received signal EXC_BAD_ACCESS, Could not access memory.
0x90039138 in pthread_join ()
(gdb) bt
#0 0x90039138 in pthread_join ()
#1 0x000f8b78 in pt_join_threads (interpreter=0x1000200) at src/thread.c:309
#2 0x0000aba0 in Parrot_really_destroy (exit_code=0, vinterp=0x1000200) at src/interpreter.c:1123
#3 0x0000c120 in Parrot_exit (status=0) at src/exit.c:48
#4 0x00003544 in main (argc=1, argv=0xbffffbd4) at imcc/main.c:555
(gdb) f 1
#1 0x000f8b78 in pt_join_threads (interpreter=0x1000200) at src/thread.c:309
309 JOIN(thread_interp->thread_data->thread, retval);
(gdb) p thread_interp->thread_data
$4 = (struct _Thread_data *) 0x903520
(gdb) p thread_interp->thread_data->thread
$5 = 0x0


And here's myconfig:

Summary of my parrot 0.0.13 configuration:
configdate='Mon Jan 5 08:33:02 2004'
Platform:
osname=darwin, archname=darwin
jitcapable=1, jitarchname=ppc-darwin,
jitosname=DARWIN, jitcpuarch=ppc
execcapable=1
perl=perl
Compiler:
cc='cc', ccflags='-g -pipe -pipe -fno-common -no-cpp-precomp -DHAS_TELLDIR_PROTOTYPE -pipe -fno-common -Wno-long-double ',
Linker and Libraries:
ld='cc', ldflags=' -flat_namespace ',
cc_ldflags='',
libs='-lm'
Dynamic Linking:
so='.dylib', ld_shared=' -flat_namespace -bundle -undefined suppress',
ld_shared_flags=''
Types:
iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4,
ptrsize=4, ptr_alignment=4 byteorder=4321,
nv=double, numvalsize=8, doublesize=8


JEff



Reply via email to