Messages in this thread | ![/](/images/icornerl.gif) | | Date | Tue, 7 Oct 2003 16:25:46 -0700 (PDT) | From | Linus Torvalds <> | Subject | RE: Who changed /proc/<pid>/ in 2.6.0-test5-bk9? |
| |
On Tue, 7 Oct 2003, Robert White wrote: > > I can say that (virtually) any programmer who does a lot of threads work is > going to presume that he may pass file handles between threads safely. > > IMHO it would be exceptionally bad to break this assumption.
That's not true.
It's true that if you use the pthreads model, you'll pass fd's between threads freely.
But there are lots of other valid thread usages. Many of the original uses of Linux threading were for special-case apps which used the clone() interface directly. Some were games, where the native threading stuff was doing things like sound etc in the background.
And when you have _that_ kind of model (with assymetric specialized threads), it makes perfect sense for the threads to have independent file descriptors.
> At the purist level, when I pass an abstraction (data structure etc) around > between my threads, having done my due-diligence WRT locking and such, I > expect that when the abstraction gets there it will still be valid.
And that is what you get with pthreads.
But the native Linux threading has never been pthreads. It's been about a much more generic thing, where the user is in control of what he does.
And that, btw, implies that thread nazis that only use pthreads do _not_ get to determine what the rest of the world does.
Linus
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |