Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
mdxi
Mar 13, 2006

to JERK OFF is to be close to GOD... only with SPURTING

Here's a thing I wrote: http://firepear.net/adminsock/

It's a mostly-automatic control/admin plugin for server software.

Adbot
ADBOT LOVES YOU

mdxi
Mar 13, 2006

to JERK OFF is to be close to GOD... only with SPURTING

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 :science:

mdxi
Mar 13, 2006

to JERK OFF is to be close to GOD... only with SPURTING

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.

mdxi
Mar 13, 2006

to JERK OFF is to be close to GOD... only with SPURTING

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.

mdxi
Mar 13, 2006

to JERK OFF is to be close to GOD... only with SPURTING

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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply