ok I've been reading more about generators and coroutines and I've watched more of that bbqsql video and I think it's starting to become clear what it's all about.
What the bbq guys use coroutines for is basically iterating over an array of sql queries, therby achieving the effect of multithreading.
Normally a query is blocking, and for good reason because the program cannot run without the data it has requested. It needs that data, so it has to wait for it to come from the db. For example a login query. The program cannot execute further instructions until it knows the status of the login attempt.
Sometimes though, like the bbq example, you want to just fire away a whole load of queries and the program doesn't rely on the answers. It doesn't matter if query 1 takes longer than query 2. All you care about is the end result, the collection of answers from all queries. So things are now allowed to run asynchronously. You could start a new thread for each query, or as bbq does, use coroutines with non blocking sql queries. This makes sense because the program will be waiting a relatively long time for the db to answer, so the cpu has time for other things while it waits.
So what bbq does is iterate over a collection of queries.
This does not translate 1:1 to prism. Prism (in its base) doesn't have iterations that use blocking IO. So I do not see any use for coroutines there.
The only blocking line of code is the select call and it should block as so not to waste cpu resources doing the main loop for no reason.
The only area where coroutines could be useful imo is plugins. But only if a plugin needs it. It doesn't make sense to turn every db query into a non blocking one using a coroutine.
If a plugin needs some information from a database - maybe the status of a racer who just joined - you could of course make that non blocking. You could make the plugin execute the query and return control to the main loop. But then the main loop needs to be notified that that particular plugin cannot be run again until the asynchronous query it's still waiting for has finished. It will complicate things a lot. And I don't think coroutines are made for this purpose.
They are made to make iterations easier. Parsing huge files for example, with a low memory footprint. Or doing many sql queries simultaneously to simulate threading. Processing of (big) collections is what generators and coroutines do best, as far as I understood it.
Generators and coroutines seem to be nice tools, but as with all tools they only work when used for the right job.
EDIT - add the usual disclaimers. I could be mistaken, as I haven't even tried them yet myself. So if you don't agree, discuss