|
Here's a thing I wrote: http://firepear.net/adminsock/ It's a mostly-automatic control/admin plugin for server software.
|
# ¿ Dec 30, 2014 04:19 |
|
|
# ¿ Apr 29, 2024 08:14 |
|
Bozart posted:It is also a bit odd to me how the sockAccept function has to handle some of the wait group and then some of it is handled in connHandler, and some of it in sockWatchDog, and some in New. I would be quite worried that it could have edge cases where after calling quit, it either hangs or can try to send to a closed channel. There's got to be a way to consolidate. I'm definitely still finding my sea-legs where writing concurrent code is concerned. Instead of passing around another synchronization channel to track completion of goroutines (so that some single point in the code can decrement the waitgroup's counter), I chose to pass around pointers to the waitgroup and have everything issue a deferred call to sync.WaitGroup.Done() as soon as it starts executing. This way, as each goroutine returns, the waitgroup's counter is decremented. I feel like it's six of one, half-a-dozen of the other. Or is there some other option, which I'm not considering? I'm still extremely wary of deadlocks and synchronization issues myself. But the adminsock test suite contains every "bad" thing I was able to come up with (so far), and makes hundreds of concurrent requests across up to 5 threads of execution. If you have any suggestions on things to try to shake out faulty behavior, I'd love to hear them
|
# ¿ Dec 30, 2014 07:20 |
|
I'll mull over the channels-vs-WaitGroup stuff, but you're completely right about sockAccept and connHandler being part of the Adminsock methodset. It is basically an accident of rapid development that they aren't already. Thank you for pointing that out.
|
# ¿ Jan 4, 2015 06:41 |
|
It may be helpful to remember that Go is a language designed at Google, for Google, to solve Google's problems, in a way which is efficacious for Google. It may also be illuminating to remember that it was designed and written by people who are already titans in their field and have absolutely nothing to prove to anyone. It is basically a pleasant side effect that Go is useful to people outside of Google. As an aside, if you don't like the design or implementation of a language, you'll feel much better (and get a lot more respect) if you (a) write code to solve a cool problem, in a language which you do enjoy, instead of (b) writing prose to tell the internet that you have decreed a language to be bad.
|
# ¿ Feb 27, 2015 00:36 |
|
Go is being ported to RISC-V, partly by people at Google and partly by volunteers. Slides and video from the 5th RISC-V workshop are available. This is pretty neat, but it'll be pretty neat-er if RISC-V ever manages to become real hardware.
|
# ¿ Dec 23, 2016 08:42 |