Stackless Python, eventual merge?
Martin v. Löwis
loewis at informatik.hu-berlin.de
Thu Sep 19 10:21:42 EDT 2002
Christian Tismer <tismer at tismer.com> writes:
> Maybe sufficient for not crashing on the C level.
> But this is not enough for micro-thread-safety.
> See the random module for example, it needs a lock
> or it will give unpredictable results.
Academically, I don't think the results are unpredictable, as
micro-thread switch occur at predictable points in processing.
Regardless, you are saying that the random module is not
thread-safe. A number of Python modules is not thread safe; many of
them won't be 'safe' in the presence of microthreads, either. With
microthreads, the problem is usually not as bad as with real threads,
since a switch usually cannot occur in the middle of a library routine
(unless the library calls back, and the call-back causes a switch).
So this is something that has been accepted all the years, and should
not cause FUD.
Regards,
Martin
More information about the Python-list
mailing list