[issue9900] Threading Bug or misuse of the api ?

Rob Watson report at bugs.python.org
Mon Sep 20 01:04:15 CEST 2010


New submission from Rob Watson <rmawatson at gmail.com>:

Is the below a bug or a misuse of the api ? This was compiled with visual studio 2008 and python26 64bit

void testfunction()
{
	for (int x = 1;x <= 100000;x++)
	{
		
		PyGILState_STATE gstate = PyGILState_Ensure();
		PyRun_SimpleString("2 + 1");
		PyGILState_Release(gstate);
	}	
}


int main()
{
	
	Py_Initialize();
	PyEval_InitThreads();
	PyEval_ReleaseLock();	
	
	boost::thread(boost::bind(testfunction));
	
        // if this Sleep(100) is commented out, I will get "Python Fatal Error : This thread state must be current when releasing"
	Sleep(100);
	testfunction();
	Sleep(1000000);
}

----------
components: None
messages: 116891
nosy: Rob.Watson
priority: normal
severity: normal
status: open
title: Threading Bug or misuse of the api ?
type: crash
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9900>
_______________________________________


More information about the Python-bugs-list mailing list