yyzybb537 / libgo

Go-style concurrency in C++11
MIT License
3.22k stars 758 forks source link

Master版本必须加co_sleep()? #124

Closed ht101996 closed 5 years ago

ht101996 commented 5 years ago

image

image

Master版本下,简单写了个程序测试了一下,co_sched.Start()后,必须要co_sleep();一下,否则程序会崩溃,这是为啥?

yyzybb537 commented 5 years ago

不必啊 你是不是链接命令和readme给的不一样啊?

ht101996 commented 5 years ago

和链接命令没关系,我改了下sample1_go.cpp 里面的代码,co_sched.Start();调用以后直接return返回,然后用cmake编译,必崩。但是co_sleep(10); 调用以后,就正常能跑。

伪代码: void fn(void) { ... } main() { go fn; co_sched.Start(); return; }

yyzybb537 commented 5 years ago

ldd看一下

ht101996 commented 5 years ago

image

centos 7.3 gcc 4.8.3

yyzybb537 commented 5 years ago

git status看看

ht101996 commented 5 years ago

image

ht101996 commented 5 years ago

ubuntu 18 的环境试了下,好像确实没问题。和系统环境有关

ubuntu的动态库少很多 linux-vdso.so.1 (0x00007ffcc4a48000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffaca701000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffaca4fd000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ffaca174000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffac9f5c000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffac9b6b000) /lib64/ld-linux-x86-64.so.2 (0x00007ffacab92000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffac97cd000)

yyzybb537 commented 5 years ago

更新一下master分支 然后再试试?

ht101996 commented 5 years ago

更新Master分支就可以了

yyzybb537 commented 5 years ago

两个系统对弱符号的处理有差异。。。。 心塞