AFAIK, in gtk+-1.2, all that is needed for threading is to link with
libgthread, and use gdk_threads_enter() and gdk_threads_leave() to mark
code that calls GUI functions.  So it would be necessary to export these 
two functions to python.  As well as this, it would be necessary to
tell the python interpreter that it can run threads while in gtk_main().
This can be done by surrounding its call with Py_BEGIN_ALLOW_THREADS and
Py_END_ALLOW_THREADS.

I am not altogether certain if this is the correct way to do things (or if
these changes would make some other parts of python or GTK break).  The
docs are not very clear about this, so I don't know.

If anyone with some knowledge on this has anything to add, please do (I am
by no means an expert on multithreading).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Wed, 10 Mar 1999, Kevin Littlejohn wrote:

> I tried to, and ran into problems.  On looking closely at it (some time
> ago), it appears that mainloop() isn't wrapped in the required magic to
> make threading work under python.  I took a stab at making it work and
> failed, unfortunately - fell back on just calling mainiteration many
> times.
> 
> If you're seeing it go into mainloop() and all your other threads
> behaving badly, that's probably it.
> 
> KevinL
> 
> >>> Aaron Optimizer Digulla wrote
> > Is someone using threads with this setup ?
> > 
> > --
> > Aaron "Optimizer" Digulla             Team AMIGA     AROS Head of Development
> > Author of XDME, ResTrackLib, CInt.                 <http://www.aros.org/>
> > "(to) optimize: Make a program faster by improving the algorithms rather than
> > by buying a faster machine."                               <[EMAIL PROTECTED]>
> > To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> > 
> 
> --------------- [EMAIL PROTECTED] ---------------
> Kevin Littlejohn,
> Technical Architect, Connect.com.au
> Don't anthropomorphise computers - they hate that.
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to