Message70598
| Author |
loewis |
| Recipients |
amaury.forgeotdarc, benjamin.peterson, loewis, pitrou |
| Date |
2008年08月01日.21:51:01 |
| SpamBayes Score |
0.0005357643 |
| Marked as misclassified |
No |
| Message-id |
<48938544.1010500@v.loewis.de> |
| In-reply-to |
<1217606100.489331d4ac51e@imp.free.fr> |
| Content |
> I should have precised that in the context of this issue, "thread-safe" does not
> mean "produces perfectly correct output" but simply "does not raise exceptions
> when using the same buffered object from two different threads".
In that case, I'm -1 for this patch. Raising exceptions is much more
preferable to silently losing data, or writing garbage.
> The former would be preferable but is not required, IMHO, for a buffered IO library; the
> latter is much more critical because as Amaury points out, you otherwise get
> exceptions when printing e.g. debut output from multiple threads.
And that's a good thing, when using a library that is not thread-safe.
Either the library provides thread-safety, or it doesn't. If it doesn't,
it's the application's responsibility to not use the library from
multiple threads, or protect all access with appropriate
synchronization. Now that print is a function, it's easy to implement
a version of it that synchronizes all prints.
With the status quo, people have at least a chance of learning that the
library is not thread-safe. If the shallow problems are resolved, people
will cry FOUL loudly when they learn about the deep problems. |
|