Max,

The msgq API probably should be deprecated, but it is in fact there in
3.10.  I think you are right that it is an issue with the GIL because
delete_head it is a long blocking function.  Are you able to use
delete_head_nowait instead?

Thanks,
Josh

On Wed, Jun 15, 2022 at 10:08 AM ikjtel <ikj12...@yahoo.com> wrote:

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

Reply via email to