News for hackers. Stuff that matters.
Re:Singleton Is a Bad Idea by postalrat on Sunday April 10, 2022 @02:14PM (#30979939)
And what happens when all those places you have the file opened want to write or read the file?
Re:Singleton Is a Bad Idea by philihp on Sunday April 10, 2022 @02:39PM (#30980257)
You fclose the handle when you're done, or you create some kind of synchronized semaphore, if you wanna be extra.

The issue is really around having multiple handles for writing (not just reading or appending), and the number of times you actually have this problem here is vanishingly rare.

Re:Singleton Is a Bad Idea by nedbat on Sunday April 10, 2022 @03:02PM (#30980516)
I'm not saying it's a good idea to open it more than once at the same time, but nothing is preventing me from doing it, so I'm not sure what is meant by, "a file is a singleton"?
Re:Singleton Is a Bad Idea by bdcravens on Sunday April 10, 2022 @02:30PM (#30980128)
In most cases nothing, the OS or applications will naively read it or write what they believe the current state to be.
Re:Singleton Is a Bad Idea by gpderetta on Sunday April 10, 2022 @02:29PM (#30980120)
They need to use some form if mutual exclusion? Same as for non-singleton objects in a process.