Threads in embedded interpreter doesn't run

devrim.erdem at devrim.erdem at
Tue Oct 19 22:55:25 CEST 2004


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()

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,

More information about the Python-list mailing list