I have a C application with many worker threads. It is essential that these do not block so where the worker threads need to write to a file on disk, I have them write to a
Why don't you wrap your entire application in another? Basically, what you want is a smart cat that copies stdin to stdout, buffering as necessary. Then use standard stdin/stdout redirection. This can be done without modifying your current application at all.