What is Nostr?
zirias (on snac) /
npub18je…uypq
2024-10-08 09:31:34

zirias (on snac) on Nostr: Having my $HOME on #NFS, I'm sometimes annoyed by lots of applications "freezing" ...

Having my $HOME on #NFS, I'm sometimes annoyed by lots of applications "freezing" when there's some issue with the NFS server. I just decided I'll try to prevent this in #Xmoji.

Now, how to do that? Nonblocking mode (which I use for sockets etc) doesn't do anything for regular files, they're always "ready to read/write". Still, actually reading or writing might block your thread. Then there's #POSIX #aio. From what I found, this has issues in real implementations, e.g. #FreeBSD uses kernel workers for implementing it, which are limited, and also doesn't even allow it on NFS by default, because it could cause deadlocks. Looking at the #Linux side, there seems to be some platform-specific async I/O implementation in the kernel, but #glibc implements the POSIX aio entirely in userspace... 🤯

Ok, screw all that. I'll do the simple thing and use worker #threads for file I/O calls, should be somewhat easy as I already have a "threadpool" in #poser. I just started doing that in my "filewatcher" in case it needs to use stat():
https://github.com/Zirias/xmoji/commit/8ba637c482e82791c9e20db21ce95a3e854b6f86

More to follow ... 😉

#C #development #async
Author Public Key
npub18jert674ht8vkxndnav3h332veq04t5qdtcdekn7sdj3q8cddvsqsduypq