pygobject r1017 - in branches/pygobject-2-16: . gio



Author: gianmt
Date: Fri Feb 20 22:27:52 2009
New Revision: 1017
URL: http://svn.gnome.org/viewvc/pygobject?rev=1017&view=rev

Log:
2009-02-17  Gustavo J. A. M. Carneiro  <gjc inescporto pt>

	* gio/gfile.override, gio/gio.defs, gio/gio.override: Bug 556250
	again.  I screwed up and gave misinformation about how to fix it.
	It must be pyg_begin/end_allow_threads, pyg_block/unblock_threads
	is only to be used for async callbacks.

2009-02-10  Gian Mario Tagliaretti  <gianmt gnome org>

	Bug 556250 â non-async functions don't release python locks before
	calling blocking C functions

	* gio/gio.override:
	* gio/gfile.override:
	* gio/gio.defs: release the thread lock.



Modified:
   branches/pygobject-2-16/ChangeLog
   branches/pygobject-2-16/gio/gfile.override
   branches/pygobject-2-16/gio/gio.defs
   branches/pygobject-2-16/gio/gio.override

Modified: branches/pygobject-2-16/gio/gfile.override
==============================================================================
--- branches/pygobject-2-16/gio/gfile.override	(original)
+++ branches/pygobject-2-16/gio/gfile.override	Fri Feb 20 22:27:52 2009
@@ -191,9 +191,13 @@
     if (!pygio_check_cancellable(pycancellable, &cancellable))
 	return NULL;
 
+    pyg_begin_allow_threads;
+
     ret = g_file_load_contents(G_FILE(self->obj), cancellable,
                                &contents, &length, &etag_out, &error);
 
+    pyg_end_allow_threads;
+
     if (pyg_error_check(&error))
         return NULL;
 
@@ -556,6 +560,8 @@
     /* No need to reference callback here, because it will be used
      * only while this function is in progress. */
 
+    pyg_begin_allow_threads;
+
     ret = g_file_copy(G_FILE(self->obj),
 		      G_FILE(destination->obj),
 		      flags,
@@ -564,6 +570,8 @@
 		      notify,
 		      &error);
 
+    pyg_end_allow_threads;
+
     if (pyg_error_check(&error))
         goto error;
 
@@ -623,6 +631,8 @@
     /* No need to reference callback here, because it will be used
      * only while this function is in progress. */
 
+    pyg_begin_allow_threads;
+
     ret = g_file_move(G_FILE(self->obj),
 		      G_FILE(destination->obj),
 		      flags,
@@ -630,6 +640,8 @@
 		      callback,
 		      notify,
 		      &error);
+    
+    pyg_end_allow_threads;
 
     if (pyg_error_check(&error))
         goto error;
@@ -1016,10 +1028,14 @@
     if (!pygio_check_cancellable(pycancellable, &cancellable))
         return NULL;
 
+    pyg_begin_allow_threads;
+
     ret = g_file_replace_contents(G_FILE(self->obj), contents, length, etag,
                                   make_backup, flags, &new_etag, cancellable,
                                   &error);
 
+    pyg_end_allow_threads;
+
     if (pyg_error_check(&error))
         return NULL;
 

Modified: branches/pygobject-2-16/gio/gio.defs
==============================================================================
--- branches/pygobject-2-16/gio/gio.defs	(original)
+++ branches/pygobject-2-16/gio/gio.defs	Fri Feb 20 22:27:52 2009
@@ -364,6 +364,7 @@
   (of-object "GBufferedInputStream")
   (c-name "g_buffered_input_stream_fill")
   (return-type "gssize")
+  (unblock-threads #t)
   (parameters
     '("gssize" "count")
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
@@ -1391,6 +1392,7 @@
   )
   (c-name "g_file_read")
   (return-type "GFileInputStream*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
@@ -1438,6 +1440,7 @@
   (of-object "GFile")
   (c-name "g_file_append_to")
   (return-type "GFileOutputStream*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
@@ -1450,6 +1453,7 @@
   (of-object "GFile")
   (c-name "g_file_create")
   (return-type "GFileOutputStream*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
@@ -1462,6 +1466,7 @@
   (of-object "GFile")
   (c-name "g_file_replace")
   (return-type "GFileOutputStream*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "etag")
@@ -1600,6 +1605,7 @@
   (of-object "GFile")
   (c-name "g_file_query_info")
   (return-type "GFileInfo*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "attributes")
@@ -1653,6 +1659,7 @@
   (of-object "GFile")
   (c-name "g_file_query_filesystem_info")
   (return-type "GFileInfo*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "attributes")
@@ -1664,6 +1671,7 @@
 (define-method find_enclosing_mount
   (of-object "GFile")
   (c-name "g_file_find_enclosing_mount")
+  (unblock-threads #t)
   (return-type "GMount*")
   (caller-owns-return #t)
   (parameters
@@ -1720,6 +1728,7 @@
   (of-object "GFile")
   (c-name "g_file_enumerate_children")
   (return-type "GFileEnumerator*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "attributes")
@@ -1773,6 +1782,7 @@
   (of-object "GFile")
   (c-name "g_file_set_display_name")
   (return-type "GFile*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "display_name")
@@ -1809,6 +1819,7 @@
   (of-object "GFile")
   (c-name "g_file_delete")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
     '("GError**" "error")
@@ -1819,6 +1830,7 @@
   (of-object "GFile")
   (c-name "g_file_trash")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
     '("GError**" "error")
@@ -1943,6 +1955,7 @@
   (of-object "GFile")
   (c-name "g_file_make_directory")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
     '("GError**" "error")
@@ -1953,6 +1966,7 @@
   (of-object "GFile")
   (c-name "g_file_make_symbolic_link")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("const-char*" "symlink_value")
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))

Modified: branches/pygobject-2-16/gio/gio.override
==============================================================================
--- branches/pygobject-2-16/gio/gio.override	(original)
+++ branches/pygobject-2-16/gio/gio.override	Fri Feb 20 22:27:52 2009
@@ -240,8 +240,12 @@
   GList *list, *l;
   PyObject *ret;
 
+  pyg_begin_allow_threads;
+
   list = g_drive_get_volumes (G_DRIVE (self->obj));
 
+  pyg_end_allow_threads;
+
   ret = PyList_New(0);
   for (l = list; l; l = l->next) {
     GVolume *volume = l->data;
@@ -330,10 +334,14 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_begin_allow_threads;
+
     g_drive_poll_for_media(G_DRIVE(self->obj),
 			   cancellable,
 			   (GAsyncReadyCallback) async_result_callback_marshal,
 			   notify);
+    
+    pyg_end_allow_threads;
 
     Py_INCREF(Py_None);
     return Py_None;
@@ -482,12 +490,16 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_begin_allow_threads;
+
     g_mount_unmount(G_MOUNT(self->obj),
 		    flags,
 		    cancellable,
 		    (GAsyncReadyCallback)async_result_callback_marshal,
 		    notify);
 
+    pyg_end_allow_threads;
+
     Py_INCREF(Py_None);
     return Py_None;
 
@@ -530,12 +542,16 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_begin_allow_threads;
+
     g_mount_eject(G_MOUNT(self->obj),
 		  flags,
 		  cancellable,
 		  (GAsyncReadyCallback) async_result_callback_marshal,
 		  notify);
 
+    pyg_end_allow_threads;
+
     Py_INCREF(Py_None);
     return Py_None;
 
@@ -592,6 +608,8 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_begin_allow_threads;
+
     g_mount_remount(G_MOUNT(self->obj),
 		    flags,
 		    mount_operation,
@@ -599,6 +617,8 @@
 		    (GAsyncReadyCallback) async_result_callback_marshal,
 		    notify);
 
+    pyg_end_allow_threads;
+
     Py_INCREF(Py_None);
     return Py_None;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]