Basic threading questions

Jason Orendorff jason at jorendorff.com
Mon Dec 31 23:15:12 CET 2001


John Lull wrote:
> I would assume that all built-in functions, and all methods of 
> all built-in types, are implemented as C functions rather than
> compiling to sequences of interpreter byte-codes.

Pretty much, yes.

> They should therefore be effectively atomic if they don't use
> blocking system services. Is that a good assumption?

Yes, mostly.  One exception:

Quite apart "blocking system services", a function that
performs long-running number-crunching might render itself
non-atomic, to give other threads a chance to run.  (I don't
think there are any examples of this in the standard library.)

> Which built-in operations are blocking should be pretty obvious 
> from either the documentation or the basic nature of the operation.

Correct.

> Are there any non-obvious blocking built-in operations?

None that I can think of.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list