Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无任何改动,执行test_coroutine产生core_dump #35

Open
xiaozhang8tuo opened this issue Aug 16, 2022 · 3 comments
Open

无任何改动,执行test_coroutine产生core_dump #35

xiaozhang8tuo opened this issue Aug 16, 2022 · 3 comments

Comments

@xiaozhang8tuo
Copy link

(gdb) bt
#0 0x000055ef99818064 in tinyrpc::Coroutine::Coroutine (this=0x55ef9b3c1b80) at /usr/include/c++/9/bits/shared_ptr_base.h:1020
#1 0x000055ef99818bfd in tinyrpc::Coroutine::Coroutine(int, char*, std::function<void ()>) (this=0x55ef9b3c2180, size=, stack_ptr=, cb=...)
at tinyrpc/coroutine/coroutine.cc:87
#2 0x000055ef99816c05 in __gnu_cxx::new_allocatortinyrpc::Coroutine::construct<tinyrpc::Coroutine, int&, char*&, void (&)()> (__p=0x55ef9b3c2180, this=)
at /usr/include/c++/9/new:174
#3 std::allocator_traits<std::allocatortinyrpc::Coroutine >::construct<tinyrpc::Coroutine, int&, char*&, void (&)()> (__p=0x55ef9b3c2180, __a=...) at /usr/include/c++/9/bits/alloc_traits.h:483
#4 std::_Sp_counted_ptr_inplace<tinyrpc::Coroutine, std::allocatortinyrpc::Coroutine, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<int&, char*&, void (&)()> (__a=..., this=0x55ef9b3c2170)
at /usr/include/c++/9/bits/shared_ptr_base.h:548
#5 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<tinyrpc::Coroutine, std::allocatortinyrpc::Coroutine, int&, char*&, void (&)()> (__a=..., __p=,
this=) at /usr/include/c++/9/bits/shared_ptr_base.h:679
#6 std::__shared_ptr<tinyrpc::Coroutine, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocatortinyrpc::Coroutine, int&, char*&, void (&)()> (__tag=..., this=)
at /usr/include/c++/9/bits/shared_ptr_base.h:1344
#7 std::shared_ptrtinyrpc::Coroutine::shared_ptr<std::allocatortinyrpc::Coroutine, int&, char*&, void (&)()> (__tag=..., this=) at /usr/include/c++/9/bits/shared_ptr.h:359
#8 std::allocate_shared<tinyrpc::Coroutine, std::allocatortinyrpc::Coroutine, int&, char*&, void (&)()> (__a=...) at /usr/include/c++/9/bits/shared_ptr.h:702
#9 std::make_shared<tinyrpc::Coroutine, int&, char*&, void (&)()> () at /usr/include/c++/9/bits/shared_ptr.h:718
#10 main (argc=, argv=) at testcases/test_coroutine.cc:44

@xiaozhang8tuo
Copy link
Author

原因似乎是线程2中的t_main_coroutine没初始化

@xiaozhang8tuo
Copy link
Author

请问可以向示例这样跨线程操作同一个协程嘛

@Gooddbird
Copy link
Owner

可以的,这里后面改了代码,忘记改用例了。协程是支持被不同线程调度的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants