#20363: GCC 5.2 pthread_detach() segmentation fault
-----------------------+------------------------
Reporter: alimzin@… | Owner: developers
Type: defect | Status: new
Priority: normal | Milestone:
Component: toolchain | Version: Trunk
Keywords: |
-----------------------+------------------------
Hello
I found a problem with threads
I test with this code with my router TP-LINK ARCHER C7
This code is simple
#include <pthread.h>
#include <stdio.h>
void *func(void *data)
{
printf("Speaking from the detached thread...\n");
pthread_exit(NULL);
}
int main()
{
pthread_t handle;
if (!pthread_create(&handle, NULL, func, NULL))
{
printf("Thread create successfully !!!\n");
if ( ! pthread_detach(handle) )
printf("Thread detached successfully !!!\n");
}
sleep(5);
printf("Main thread dying...\n");
return 0;
}
With GCC 5.2 in my debian 7, i have no problem. This software works
correctly
# /tmp/test_detach
Thread create successfully !!!
Thread detached successfully !!!
Speaking from the detached thread...
Main thread dying...
Thie same software no work with this toolchain /TOOLCHAIN/toolchain-
mips_34kc_gcc-5.1.0_musl-1.1.9/bin/ on my router
# /tmp/test_detach
Segmentation fault
Toolchain gcc version 5.1.0 (OpenWrt GCC 5.1.0 r45886)
My command for compile
gcc -lpthread /tmp/test_detach.c -o /tmp/test_detach
And for dd-wrt
mips-linux-gcc -lpthread /tmp/test_detach.c -o /tmp/test_detach
Why ? The librairie –lpthread have a problem ?
pthread_detach() crash my software
help :(
--
Ticket URL: <https://dev.openwrt.org/ticket/20363>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets