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
how to pass context and other args in pool_func? #81
Comments
You can define a |
yes, this is what i first want resolution, but the context arg was not suggested to put into struct, so a little complex |
Then I'm out of solutions, maybe I should start considering refactor |
@panjf2000 could use this method? for j := 0; j < batchCount; j++ {
bj:=j
routinePoll.Submit(func() {
genBucketBatch(bj)
})
} |
I don't quite get your point, what did you want to ask exactly? Is your question related to this issue? if not, please open your own issue. |
that works for me, thk~ |
I have the same problem with args and it would be better if it was ...interface{} instead of interface{}. |
Thank you so much! This works for me without creating a new pool with function. |
same issue, how to pass multi args of task, is there any good suggestion? |
|
这个问题有进展吗,字节有一个简短的任务池实现,里面也支持ctx。可以提交包含ctx的任务,还是非常重要的,submit(ctx, func()) |
传入 context 后,是在用户代码里自己使用还是说要在 |
hello, @panjf2000
func NewPoolWithFunc(size int, pf func(interface{}), options ...Option)
in NewPoolWithFunc, pf only have an ingerface{}, but i want to pass at least two args, how to solve tihes?
my run function like :
context is not suggested to put into a struct, how to pass ctx + args as one task to queue?
The text was updated successfully, but these errors were encountered: