3 ms·
How could you know what your threads are doing at the time you call fork? That doesn't sound safe. I write such code in a way that threads communicate with each
by swartkrans 12y ago
How could you know what your threads are doing at the time you call fork? That doesn't sound safe. I write such code in a way that threads communicate with each other when they need to, but if I start assuming what those threads are doing that seems like it could get really complicated really fast.
- thetrb 12y agoSure it can get complicated, but there are also some safe ways to fork. Imagine you fork at the very beginning of your program before starting any threads. No danger in that. So the language could at least allow it (but provide the proper warnings around it).
- Vendan 12y agothe issue arises when the programming language doesn't let you run code before the threads split out, like golang.
- Dylan16807 12y agoI don't know exactly what they're doing, but being able to reason that they are not performing file IO is a vastly easier problem than figuring out a completely safe point to kill them all.