Hi:
I ran into this when I started to write Go programmes. I make main
wait on a channel. This may not help right now but some suggestions.
In Stackless, there is a method called stackless.getruncount() that
returns the number of
scheduled tasklets (coroutines)
So the main coroutine to have the following structure
set up the code
while getruncount() > 1:
schedule()
(in reality, a stackless programme uses stackless.run())
I notice in the runtime package, there is a function called Gosched()
that yields the processor.
It may not be difficult to put in a Gogetruncount()?
Based on stackless experience, an additional advantage I see is if the
programme deadlocks(i.e., due to cycle), the loop gracefully
terminates and one stands a fighting chance to run a deadlock
detector.
Cheers,
Andrew