A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033392.html below:

[Python-Dev] Change definition of Py_END_ALLOW_THREADS?

[Python-Dev] Change definition of Py_END_ALLOW_THREADS? [Python-Dev] Change definition of Py_END_ALLOW_THREADS?Mark Hammond mhammond@skippinet.com.au
Fri, 14 Feb 2003 09:42:53 +1100
> > OTOH, in the code I am patching there already exists "#ifdef
> > __cplusplus" - I am so tempted to add a tiny little extra block
> > define a helper C++ class in the Python sources for managing this.
> > However, if I do that I fear the Spanish Inquisition will look like
> > a stroll in the park <wink>
>
> Cardinal Biggles, get the soft cushions!

:)

> Actually, relying on C++ would be bad, since this might be useful
> outside Windows as well.

Well, I was thinking of:

#ifdef __cplusplus
class PyAutoThreadState {
  PyAutoThreadState() {state = PyAutoThreadState_Ensure();}
  ~PyAutoThreadState() {PyAutoThreadState_Restore(state);}
  PyAutoThreadState_State state;
}
#endif

Meaning the C level API is always there, but a C++ compiler on any platform
should allow extension authors to say:

void MyCppFunc(void)
{
   PyAutoThreadState state;
}

And the rest happens by magic.

Was-only-half-serious-but-getting-more-so ly,

Mark.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4