Feature Requests item #443775, was opened at 2001-07-23 05:34 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=443775&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: None >Status: Closed >Resolution: Rejected Priority: 1 Private: No Submitted By: Martin Sj�gren (msjogren) Assigned to: Nobody/Anonymous (nobody) Summary: Update to the BEGIN_ALLOW_THREADS macros Initial Comment: The Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS currently do not support supplying WHERE to save the thread state via an argument. I needed that for a project myself so I wrote the following: #ifdef WITH_THREAD # define MY_BEGIN_ALLOW_THREADS(st) \ { st = PyEval_SaveThread(); } # define MY_END_ALLOW_THREADS(st) \ { PyEval_RestoreThread(st); st = NULL; } #else # define MY_BEGIN_ALLOW_THREADS(st) # define MY_END_ALLOW_THREADS(st) { st = NULL; } #endif This has, of course, the drawback that whenever the Py_BEGIN_ALLOW_THREADS macro changes I have to change mine! Therefore, I propose that these macros (under different names certainly) or macros that work something like this (I can't have asymmetric { and } in them, since I needed to retrieve the thread state somewhere else) in the standard Python distribution. ---------------------------------------------------------------------- >Comment By: Neal Norwitz (nnorwitz) Date: 2007-03-15 22:27 Message: Logged In: YES user_id=33168 Originator: NO As Brett says, you can use the _save variable. Since no one else has requested this feature it doesn't seem worth it to change. ---------------------------------------------------------------------- Comment By: Brett Cannon (bcannon) Date: 2003-05-12 17:08 Message: Logged In: YES user_id=357491 Couldn't you cheat and access the _save variable that Py_BEGIN_ALLOW_THREADS creates? And does PEP 311 help solve your usage need at all? ---------------------------------------------------------------------- Comment By: Michael Dubner (dubnerm) Date: 2003-01-17 21:16 Message: Logged In: YES user_id=39274 I think that current Py_BEGIN/END_ALLOW_THREADS macroses model (with block) is choosen to enforce compile-time pairwise check. Isn't it? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=443775&group_id=5470
_______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com