Problems with Threads

Aahz Maruch aahz at panix.com
Thu Aug 9 17:48:34 EDT 2001


In article <mailman.997216332.2935.python-list at python.org>,
superfix <superfix at bol.com.br> wrote:
>
>Hello guys. I have been some problems with threads in 
>python/c. Let me try explanation this:
>	- I have an interface write in python for c
>	- In this interface I call a module write in c
>	- In this module I call glutmainloop, otherwise, 
>the program enters in loop to refresh the opengl 
>aplication.
>
>So, I need to return to python interpreter. otherwise, I need to keep
>two aplications in my program: python window and opengl window. Note: I
>need to keep the terminal active together opengl.
>
>	/*Api*/
>	include <module.c>
>	. . . . . . .
>	static PyObject *agg_CreatAgent(PyObject *self, PyObject *args)
>	{
>		int x;
>    		if (!PyArg_ParseTuple(args, "i", &x)
>			return NULL;
> 
>		Py_BEGIN_ALLOW_THREADS
>			open_function(x, "filename");
>  	 	Py_END_ALLOW_THREADS
>	
>		Py_INCREF(Py_None);
>    		return Py_None;
>	}
>	
>Effect. Python simply call the open_function and fall in loop. How I
>can return the control to the python and keep this thread active?  Any
>thoughts?

What's this thread supposed to do?  It sounds to me like you need to
clarify your application logic.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"i-write-best-when-the-audience-is-me-ly y'rs  - tim"



More information about the Python-list mailing list