23,223
社区成员
发帖
与我相关
我的任务
分享
pthread_create(&s,NULL,caller,&in1);
pthread_create(&t,NULL,caller,&in2);
pthread_join(s,&hm1);
pthread_join(t,&hm2);
void *caller(void * arg)
{
long long it=sixdegreeI::bfs(arg);
return (void*)it;
}
long long sixdegreeI::bfs(void * arg)
{
signal(SIGTERM,handler);
//此处省略many行
int pkillre=pthread_kill(kill,0);
if(pkillre!=ESRCH&&pkillre!=EINVAL)
{
pthread_kill(kill,SIGTERM);//kill为两个线程中另一个线和的TID
}
}
void handler(int a)
{
pthread_exit(0);
//return ;
}
terminate called without an active exception
Program received signal SIGABRT, Aborted.
0x0000003ca772e26d in raise () from /lib64/tls/libc.so.6
(gdb) bt
#0 0x0000003ca772e26d in raise () from /lib64/tls/libc.so.6
#1 0x0000003ca772fa6e in abort () from /lib64/tls/libc.so.6
#2 0x0000003ca9bb11be in __gnu_cxx::__verbose_terminate_handler () from /usr/lib64/libstdc++.so.6
#3 0x0000003ca9baf176 in __cxa_call_unexpected () from /usr/lib64/libstdc++.so.6
#4 0x0000003ca9baf1a3 in std::terminate () from /usr/lib64/libstdc++.so.6
#5 0x0000003ca9baf03a in __gxx_personality_v0 () from /usr/lib64/libstdc++.so.6
#6 0x0000003ca8a089e5 in _Unwind_RaiseException () from /lib64/libgcc_s.so.1
#7 0x0000003ca8a08afc in _Unwind_ForcedUnwind () from /lib64/libgcc_s.so.1
#8 0x0000003ca800add0 in __pthread_unwind () from /lib64/tls/libpthread.so.0
#9 0x0000003ca8006fb5 in pthread_exit () from /lib64/tls/libpthread.so.0
#10 0x000000000040bf7d in handler (a=15) at server.cpp:24
#11 <signal handler called>
#12 0x0000003ca776b6e6 in malloc () from /lib64/tls/libc.so.6
#13 0x0000003ca9baf5aa in operator new () from /usr/lib64/libstdc++.so.6
#14 0x000000000041412a in __gnu_cxx::new_allocator<__gnu_cxx::_Hashtable_node<std::pair<long long const, char> > >::allocate
(this=0x42803060, __n=1) at /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ext/new_allocator.h:81
#15 0x000000000041287b in __gnu_cxx::hashtable<std::pair<long long const, char>, long long, longtoint, std::_Select1st<std::pair<long long const, char> >, std::equal_to<long long>, std::allocator<char> >::_M_get_node (this=0x42803060)
at /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ext/hashtable.h:252
#16 0x0000000000410e9a in __gnu_cxx::hashtable<std::pair<long long const, char>, long long, longtoint, std::_Select1st<std::pair<long long const, char> >, std::equal_to<long long>, std::allocator<char> >::_M_new_node (this=0x42803060,
__obj=@0x42802e90) at /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ext/hashtable.h:528
#17 0x000000000040f34d in __gnu_cxx::hashtable<std::pair<long long const, char>, long long, longtoint, std::_Select1st<std::pair<long long const, char> >, std::equal_to<long long>, std::allocator<char> >::find_or_insert (this=0x42803060,
__obj=@0x42802e90) at /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ext/hashtable.h:710
#18 0x000000000040e5c6 in __gnu_cxx::hash_map<long long, char, longtoint, std::equal_to<long long>, std::allocator<char> >::operator[] (this=0x42803060, __key=@0x1e2c850)
at /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ext/hash_map:181
#19 0x000000000040c6f9 in sixdegreeI::bfs (arg=0x413fff20) at server.cpp:124
#20 0x000000000040bfc3 in caller (arg=0x413fff20) at server.cpp:30
#21 0x0000003ca8006137 in start_thread () from /lib64/tls/libpthread.so.0
#22 0x0000003ca77c9883 in clone () from /lib64/tls/libc.so.6
(gdb)