What is Nostr?
Nicolas Martyanoff /
npub17vs…jc6l
2024-02-17 12:49:10
in reply to nevent1q…zceg

Nicolas Martyanoff on Nostr: npub1fzx00…wt6h3 The Go runtime handles IO events. Goroutines yield on IO and ...

npub1fzx00c36ny4whyuhg4ykx6987wxp885fmwmc784n27qcu6pavwzs3wt6h3 (npub1fzx…t6h3) The Go runtime handles IO events. Goroutines yield on IO and function calls (and IIRC regularly to avoid having long computation not using functions hog a core). From your perspective, IO functions block execution, but in reality they just block the current goroutine while others will continue to execute.

So no risk of having inactive sockets blocking your entire server, no callback hell, all computations where some parts require IO are layed down linearly, errors are handled where they are triggered, etc.

This is the right way to do concurrency; Go and Erlang are the only two major languages to do it.
Author Public Key
npub17vstmkjpd25e72hqjjwu54krhav2nq2unhnm49g268a9drdzhqtqjmjc6l