✅ Replace enum with class name
I'm working on an API right now which, for those familiar with OpenMP, is a parallel programming API which aims to implement OpenMP functionality as faithfully as possible.
With that said, the current API has the following syntax for declaring a parallel-for loop:
I am looking at the possibility of implementing custom schedulers as defined by the user through some sort of consistent interface. I am not looking for API/ABI compatibility, but source code compatibility would be highly desired. What I would like is to be able to have the
(Before you ask: yes, I know about the TPL. Yes, I have my reasons for not using it. No, I don't want to get into them in this thread, I want to focus on the issue at hand. The provided function is extremely similar to
With that said, the current API has the following syntax for declaring a parallel-for loop:
I am looking at the possibility of implementing custom schedulers as defined by the user through some sort of consistent interface. I am not looking for API/ABI compatibility, but source code compatibility would be highly desired. What I would like is to be able to have the
DotMP.Schedule enum be replaced with classes that implement the IScheduler interface. How would I incorporate this into the type signature to be source-compatible? For instance:(Before you ask: yes, I know about the TPL. Yes, I have my reasons for not using it. No, I don't want to get into them in this thread, I want to focus on the issue at hand. The provided function is extremely similar to
System.Threading.Tasks.Parallel.For on the surface, but it is implemented significantly different, and there's much more to my library besides this that the TPL is not flexible enough to do.)