LWN.net Logo

Coroutines

Coroutines

Posted May 9, 2012 16:39 UTC (Wed) by hanwen (subscriber, #4329)
In reply to: Coroutines by juliank
Parent article: nPth - The new GNU portable threads library

According to the spec Go, but you still need locking between goroutines; an implementation which uses 1 thread per go-routine is conforming.


(Log in to post comments)

Coroutines

Posted May 9, 2012 18:51 UTC (Wed) by juliank (subscriber, #45896) [Link]

Goroutines are transparently moved across threads, and work correctly, as long as you do not access shared memory (which you should not do).

Coroutines

Posted May 11, 2012 13:43 UTC (Fri) by hanwen (subscriber, #4329) [Link]

well, you need synchronization. Either channels or locks. A coroutine which does not synchronize at all may be optimized to not run at all, according to the spec.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds