async
async copied to clipboard
Why not support non-empty arguments function with Concurrent or Parallel?
Are you receiving any error while using non-empty arguments function with Concurrent or Parallel? Can you show us any example of what you are trying to do?
Are you receiving any error while using non-empty arguments function with Concurrent or Parallel? Can you show us any example of what you are trying to do?
Hi, it seems that concurrent/parallel API don't support pass parameters
func execRoutine(f reflect.Value, c chan execResult, key string) { var ( exr = execResult{} // Result res = f.Call(emptyArgs) // Calls the function )
Routine call function with emptyArgs in func.go
@hawkinggg I see. When writing those functions three years ago I thought of Parallel and Concurrent functions receiving an optional list of parameters as last argument that would be passed to every function passed to them, but at the time I had no use for this case.
Maybe a modification like:
async.Concurrent(async.Tasks{
func(i int, s string, b bool) error { ... },
func(i int, s string, b bool) error { ... },
func(i int, s string, b bool) error { ... },
}, 1, "test", false)
Could solve the problem without breaking the current usage of the package.
@rafaeldias
Hi, 4 years later, I see that this library has a lot of potential. Can you make me as the contributor to this library? I will resolve those 2 issues.
@MrNocTV I believe, you may start with creating pull requests to resolve those issues without becoming a contributor, by just forking it and making a PR from your fork. Additionally, if the maintainer of this library won't have time for the job, community we'll be able to continue to live with the fork