The script pasted below runs OK in 3.8 but hangs (with no iteration output) in 3.10 (Ubuntu 22.04). Naturally no message is anticipated - but the script should not hang!
This problem is blocking the release of OP25 for GR3.10.
I suspect deadlock due to failure to release the Python GIL.
Kindly advise - thx
Max
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/env python
import os
import sys
import threading
import time
from gnuradio import gr
class queue_watcher(threading.Thread):
def __init__(self, msgq, callback, **kwds):
threading.Thread.__init__ (self, **kwds)
self.msgq = msgq
self.callback = callback
self.keep_running = True
print ('starting thread')
self.start()
def run(self):
while(self.keep_running):
msg = self.msgq.delete_head()
if not self.keep_running:
break
self.callback(msg)
def callback(msg):
print('callback: msg received: %d' % msg.type())
my_msgq = gr.msg_queue(1)
watcher = queue_watcher(my_msgq, callback)
i = 0
while True:
time.sleep(1)
print('main loop running iteration %d' % i)
i += 1