[Python-Dev] Change definition of Py_END_ALLOW_THREADS? (original) (raw)

Michael Hudson mwh@python.net
Fri, 14 Feb 2003 11:11:03 +0000


"Gerald S. Williams" <gsw@agere.com> writes:

I guess: PyAUTOTHREADSTATEDECLARE PyAUTOTHREADSTATEENSURE PyAUTOTHREADSTATERELEASE

would work. If you need the declaration, I'd vote for making it explicit. I only suggested the macro for consistency with what's been done before.

What about no-thread builds? Or are these macros not for use in the core?

[Tim]

Pragmatic company likes it: the braces make it very likely you'll get cascades of baffling compile-time errors if you don't use the BEGIN/END macros in matched pairs. That's better than cascades of baffling runtime errors.

At one point I had a patch up on sf that went

if (something) Py_BEGIN_ALLOW_THREADS ioctl(stuff); if (something) Py_END_ALLOW_THREADS

It compiled, at least.

gotta-love-the-C-preprocessor-ly y'rs M.

-- First time I've gotten a programming job that required a drug test. I was worried they were going to say "you don't have enough LSD in your system to do Unix programming". -- Paul Tomblin -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html