Hello all,
I couldn't get working nested function passed by name to another
function inside the thread.
Code showing below failed with SIGSEGV:
Program received signal SIGSEGV, Segmentation fault.
0x0806a928 in ?? ()
(gdb) bt
#0 0x0806a928 in ?? ()
#1 0x08048503 in funA (f=0x806a928) at test.c:6
#2 0x0804854d in thread (arg=0x0) at test.c:12
#3 0x00489c7b in pth_spawn_trampoline () from /usr/lib/libpth.so.20
#4 0x0098eee4 in makecontext () from /lib/tls/libc.so.6
#5 0x0805a970 in ?? ()
#6 0x00000000 in ?? ()
I didn't find in the man pages anything about restriction using nested
functions. Is this supposed to work at all with PTH?
My platform: Linux 2.6.9-5.ELsmp #1 SMP i386 GNU/Linux
Pth Version: GNU Pth 2.0.7 (08-Jun-2006)
Here's the lab test:
#include <pth.h>
void funA(void (*f)())
{
f();
}
void *thread(void *arg)
{
void f() {}
funA(f);
return (void*)0;
}
int main(int argc, char *argv[])
{
if (pth_init() != TRUE)
return -1;
pth_attr_t attr = pth_attr_new();
pth_t pth;
if ((pth = pth_spawn(attr, thread, NULL)) == NULL)
return -1;
void *ret = 0;
if (pth_join(pth, &ret) != TRUE)
return -1;
return (int)ret;
}
______________________________________________________________________
GNU Portable Threads (Pth) http://www.gnu.org/software/pth/
Development Site http://www.ossp.org/pkg/lib/pth/
Distribution Files ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List [email protected]
Automated List Manager (Majordomo) [EMAIL PROTECTED]