Posted 19 May 2014 - 05:58 PM
I have a hard time understanding coroutines, but I'd like to make a thread-safe multi-threading API for basically allowing you to do more than the parallel (API), it's an objected-oriented (API) that allows you to add tasks to the list, remove tasks from the list, run tasks in the list, stop tasks in the list, resume tasks in the list, pause tasks in the list and this would be in-order and thread-safe.
Add / Remove tasks, will add or remove tasks from the list, if a task is running and then removed it will stop and get removed.
Start / Stop tasks, starting tasks will stop if it's already running and start from the beginning, stopping tasks will just stop it.
Resume / Pause, tasks can be paused and then resumed to continue.
By thread-safe, I mean synchronized with every other task.
Could thread-safety be possible, if so then how? And how could I make such an API? Thanks, if you can explain your code that's be even better. If someone has such an API already, can they please showcase it here and explain it? Thanks again.
Regards,
Augustas
Add / Remove tasks, will add or remove tasks from the list, if a task is running and then removed it will stop and get removed.
Start / Stop tasks, starting tasks will stop if it's already running and start from the beginning, stopping tasks will just stop it.
Resume / Pause, tasks can be paused and then resumed to continue.
By thread-safe, I mean synchronized with every other task.
Could thread-safety be possible, if so then how? And how could I make such an API? Thanks, if you can explain your code that's be even better. If someone has such an API already, can they please showcase it here and explain it? Thanks again.
Regards,
Augustas