News for hackers. Stuff that matters.
Re:Go-style concurrency in C by _ak on Wednesday November 18, 2015 @01:29AM (#10586313)
If you want Go-style concurrency, why not use Go in the first place?
Re:Go-style concurrency in C by rumcajz on Wednesday November 18, 2015 @02:47AM (#10586516)
My primary use case was writing network protocols (the stuff I had to deal extensively when implementing ZeroMQ and nanomsg). On one hand you want ultimate performance, i.e. no context switchers, manual memory allocation et c. On the other hand, you want the convenience of writing linear code without caring about what to do when function blocks.
Re:Go-style concurrency in C by zobzu on Wednesday November 18, 2015 @02:41AM (#10586502)
I you've written advanced-enough go, you probably have a bunch of file that start with some C code before the Go code starts.

Go simply can't interface everything the way C does. Go doesn't give you the same level of flexibility either.

tldr: Go's great, but it's just not as powerful as C (unlike Rust or some others, which can do anything C does).

Re:Go-style concurrency in C by _ak on Wednesday November 18, 2015 @03:03AM (#10586558)
What specifically are you talking about? Go can do syscalls perfectly fine, you can mess in your memory perfectly fine (even if you have to resort to the unsafe package), so what exactly is it where you think Go lacks flexibility compared to C? Because so far, your posting sounds rather hand-wavy.
Re:Go-style concurrency in C by wishing_for_ffi on Wednesday November 18, 2015 @11:27AM (#10588673)
One problem is that it's very hard to call go libraries from other languages (it requires a runtime). C libraries can be called from almost any language.

There are many go libraries I would love to use, but can't because of this. I expect many others are in a similar boat.

Re:Go-style concurrency in C by zobzu on Wednesday November 18, 2015 @02:10PM (#10589969)
For ex try to read the data from a signal. Another example is to start a namespace before all threads start.

I can go on for a while :)

Re:Go-style concurrency in C by cthrowago on Wednesday November 18, 2015 @01:38AM (#10586334)
I can imagine it being nice if you're tied to existing C code. Or if you want C-style memory management.
Re:Go-style concurrency in C by jagger27 on Wednesday November 18, 2015 @01:36AM (#10586328)
Garbage collection.
Re:Go-style concurrency in C by _ak on Wednesday November 18, 2015 @02:12AM (#10586427)
What stuff are you working on where the runtime guarantees of the Go 1.5 GC aren't good enough?
Re:Go-style concurrency in C by jagger27 on Wednesday November 18, 2015 @02:23AM (#10586455)
Me personally? Nothing. I'm sticking with Go.
Re:Go-style concurrency in C by _ak on Wednesday November 18, 2015 @02:59AM (#10586550)
Exactly. I'd argue that the majority of people complaining about Go being unusable for them because of the GC would actually be able to deal with the GC easily. I'm working on a soft realtime application in Go, and the GC has never gotten in the way.
Re:Go-style concurrency in C by lmm on Wednesday November 18, 2015 @05:55AM (#10587007)
Right back at you though: I'd argue that the majority of people complaining about OCaml (or even the JVM) being unusable for them (and using Go instead) would actually be able to deal with it easily.
Re:Go-style concurrency in C by _ak on Wednesday November 18, 2015 @10:16AM (#10588120)
Stop derailing this discussion about Go GC vs. C no GC.
Re:Go-style concurrency in C by lmm on Wednesday November 18, 2015 @10:57AM (#10588388)
It is relevant though. You're talking about the large number of people who are using C and don't need no GC as though they're people who should be using go - but if they don't need no GC they probably don't need a language as low-level as go full stop and would be better served by a more expressive alternative. Ultimately, a large proportion of "people who need go or C" actually need C, making this library a good idea.
Re:Go-style concurrency in C by fmstephe on Wednesday November 18, 2015 @05:15AM (#10586918)
Can you elaborate about your experiences writing soft real-time in Go. Is your project open source?
Re:Go-style concurrency in C by stefantalpalaru on Wednesday November 18, 2015 @07:55AM (#10587384)
You don't even need to use Go, the gccgo implementation of the runtime (including garbage collection) is available from C: https://github.com/stefantalpalaru/golib