Anyone have some magic to allow me to time out a syscall to flock on Linux? Google says you can signal the process with sigalrm but more Google says that the signal has to go to exactly the same thread as the blocking flock, which of course is tough with goroutines (and in testing, signalling my own process from another goroutines didn't work). Any other suggestions? I currently am using a nonblocking call to flock and just looping with a sleep, but that feels really janky.
Having a single goroutine that may block for an extended period is probably ok, I was just hoping to avoid it, if someone had some way of signalling the syscall to terminate it.
FWIW, closing the file descriptor and/or unlocking from another goroutine did not unblock the goroutine waiting on the flock syscall (I had hoped it would, but my tests say no).