Message70598
> 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. |
|
| Date |
User |
Action |
Args |
| 2008-08-01 21:51:03 | loewis | set | recipients:
+ loewis, amaury.forgeotdarc, pitrou, benjamin.peterson |
| 2008-08-01 21:51:02 | loewis | link | issue3476 messages |
| 2008-08-01 21:51:01 | loewis | create | |
|