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

协程coroutine.wrap()创建,断点断不住 #151

Open
Zheng-Hongyi opened this issue Jun 28, 2022 · 4 comments
Open

协程coroutine.wrap()创建,断点断不住 #151

Zheng-Hongyi opened this issue Jun 28, 2022 · 4 comments

Comments

@Zheng-Hongyi
Copy link

看了一下源码,只处理了coroutine.create(),没有处理coroutine.wrap(),这个如何更好的处理?

@Zheng-Hongyi
Copy link
Author

Debug下钩子需要传thread,coroutine.wrap()方式创建的协程如何去拿thread?

@stuartwang
Copy link
Collaborator

我最近查了一下,这里确实没还有想到好的处理办法,有空的时候我再研究下

@Dadio44
Copy link

Dadio44 commented Nov 2, 2023

遇到了一样的问题,现在有解决方案了吗?

@Dadio44
Copy link

Dadio44 commented Nov 2, 2023

Xlua 的协程就是因为这个问题无法用 luaPanda 断点,试着用 coroutine.resume 替换 coroutine.wrap 解决了
源代码
`local move_end = {}

local generator_mt = {
__index = {
MoveNext = function(self)
self.Current = self.co()
if self.Current == move_end then
self.Current = nil
return false
else
return true
end
end;
Reset = function(self)
self.co = coroutine.wrap(self.w_func)
end
}
}
改成local generator_mt = {
__index = {
MoveNext = function(self)
return coroutine.resume(self.co)
end;
Reset = function(self)
self.co = coroutine.create(self.w_func)
end
}
}`

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

3 participants