How let go and c code work Alternately in the same thread with
goroutine(corouting mechanism)
Check the code below. c and go code in one thread they just do work 1 by 1.
Expected Result
> Do CWork
> Do GoWork
> Do CWork
> Do GoWork
> Do CWork
> .....
//c code
> void CWork() {
> while(1) {
> --Print Do CWork
> --Coroutine Stop
> --switch to GoWork()
> }
> }
> int main() {
> CWork();
> }
> //go code
> func GoWork() {
> for {
> --Print Do GoWork
> --Coroutine Stop
> --switch back to CWork()
> }
> }
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.