Threads in embedded interpreter doesn't run

devrim.erdem at gmail.com devrim.erdem at gmail.com
Tue Oct 19 16:55:25 EDT 2004


Hello,

I am trying to implement threads in my embedded interpreter.

The host application is a C++ app which has a built-in python
interpreter. After initialization of the app just before it starts an
endless while loop ( which does  OpenGL rendering ) the thread is
created and started. Like this :

class TmpThread( threading.Thread ):
	def __init__( self ):
		threading.Thread.__init__( self )
		print "%s is constructed." % self
	def run(self):		
		while( 1 ):
			print "this is tmpthread"
			time.sleep( 1 )

tmp = TmpThread()
tmp.start()

The problem is that the thread prints its message a couple of times
and then stops. During the main loop of my program, the python thread
doesn't run. After termination of the loop, the thread starts printing
the message.

Could anyone give me some hints to understand why the thread can not
execute during my application loop.

Thanks in advance,
Devrim.



More information about the Python-list mailing list