[PATCH v2] Release the GIL while running a gdb command or expression

Pedro Alves palves@redhat.com
Fri Oct 12 16:56:00 GMT 2018


On 10/10/2018 09:22 PM, Tom Tromey wrote:
> +
> +# Define a function for the thread

While at it, add missing periods?

> +def print_thread_hello():
> +   count = 0
> +   while count < 10:
> +      time.sleep(1)
> +      count += 1
> +      print ("Hello ( %d )" % count)
> +
> +# Create a thread and continue

Ditto.

> +try:
> +   thread.start_new_thread (print_thread_hello, ())
> +   gdb.execute ("continue", release_gil=True)
> +except:
> +   try:
> +      _thread.start_new_thread (print_thread_hello, ())
> +      gdb.execute ("continue", release_gil=True)

But what I came here for, is:

AFAICT, "release_gil" was not included in this version of
the patch, so that shouldn't be here either.  

The test should be failing because of that, I believe,
because GDB should be complaining that release_gil
is an invalid keyword.  Does the test somehow
happen to still pass with that?

> +   except:
> +      print ("Error: unable to start thread")

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list