Doubt on what can I do from secondary threads
- From: Conscious User <conscioususer gmail com>
- To: python-hackers-list gnome org
- Subject: Doubt on what can I do from secondary threads
- Date: Tue, 08 May 2012 09:37:18 -0300
Hi,
I am using a little bit of Python threading in my app and I know
that I'm supposed to either use the (soon-to-be-deprecated)
Gdk.threads_enter/Gdk.threads_leave pair or (preferably)
GLib.idle_add to call Gdk/Gtk methods from secondary threads.
I'm in doubt whether I can do two basic operations directly from
secondary threads:
1) Create new references to Gdk/Gtk objects. For example, if
"a" is a variable that references a Gdk/Gtk object, can I do
"b = a" in a secondary thread?
2) Call methods of a Gdk/Gtk object, but methods that I created
in a subclass and that do nothing directly related to Gdk/Gtk.
For example, if I have a class like
class MyButton(Gtk.Button):
def my_method(self):
a = 1 + 1
can I call my_method from a secondary thread?
Those doubts come from the fact that I don't know what
PyGObject does under the hood. For example, it obviously
does some GObject refcount updates in case (1), but I'm
in doubt whether this "touches" Gtk/Gdk somehow.
Thanks!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]