0

On which thread does the callback function gets executed after every "interval" milliseconds when we schedule a function using the following method??

def glib.timeout_add(interval, callback, ...)

https://developer.gnome.org/pygobject/stable/glib-functions.html#function-glib--timeout-add

imagin
  • 317
  • 3
  • 13

2 Answers2

2

In the thread which is running the default main loop.

nemequ
  • 16,623
  • 1
  • 43
  • 62
0

If it's not documented, you'll either have to read the source code, or you can print out the return value from thread.get_ident() from inside the callback function and compare it to values printed from inside known threads within your code.

It's possible that the ident won't match any of the other threads, in which case it will be a thread created internally just for the purposes of the callbacks.

Aya
  • 39,884
  • 6
  • 55
  • 55