Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I found adopting a functional reactive programming really works well for multithreaded systems.

GCD is super great and I use it a lot (...if you had to extend AsyncTask recently: my condolences), but it doesn't safeguard you from race conditions, dealing with locks and all that fun stuff.



I don't have a lot of golang experience, but from what I can see here, golang doesn't really either: https://tour.golang.org/concurrency/1

Channels seem like a simple thread safe stream for the most part, which you can get with Rx.


This is correct, golang doesn't give you thread safety for free. Values passed via channels are safe as they're implicitly locked (i.e. it's a blocking threadsafe queue), and there are happens-before semantics for starting a goroutine, otherwise you're on your own (explicit locks / atomics / lock-wrappers like sync.WaitGroup). E.g. variable assignment isn't even atomic.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: