pygobject r1004 - in trunk: . gio



Author: gianmt
Date: Mon Feb 16 21:10:32 2009
New Revision: 1004
URL: http://svn.gnome.org/viewvc/pygobject?rev=1004&view=rev

Log:
release the thread lock on non-async functions.

Modified:
   trunk/ChangeLog
   trunk/gio/gfile.override
   trunk/gio/gio.defs
   trunk/gio/gio.override

Modified: trunk/gio/gfile.override
==============================================================================
--- trunk/gio/gfile.override	(original)
+++ trunk/gio/gfile.override	Mon Feb 16 21:10:32 2009
@@ -191,9 +191,13 @@
     if (!pygio_check_cancellable(pycancellable, &cancellable))
 	return NULL;
 
+    pyg_unblock_threads();
+
     ret = g_file_load_contents(G_FILE(self->obj), cancellable,
                                &contents, &length, &etag_out, &error);
 
+    pyg_block_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_unblock_threads();
+
     ret = g_file_copy(G_FILE(self->obj),
 		      G_FILE(destination->obj),
 		      flags,
@@ -564,6 +570,8 @@
 		      notify,
 		      &error);
 
+    pyg_block_threads();
+
     if (pyg_error_check(&error))
         goto error;
 
@@ -698,6 +706,8 @@
     /* No need to reference callback here, because it will be used
      * only while this function is in progress. */
 
+    pyg_unblock_threads();
+
     ret = g_file_move(G_FILE(self->obj),
 		      G_FILE(destination->obj),
 		      flags,
@@ -705,6 +715,8 @@
 		      callback,
 		      notify,
 		      &error);
+    
+    pyg_block_threads();
 
     if (pyg_error_check(&error))
         goto error;
@@ -1091,10 +1103,14 @@
     if (!pygio_check_cancellable(pycancellable, &cancellable))
         return NULL;
 
+    pyg_unblock_threads();
+
     ret = g_file_replace_contents(G_FILE(self->obj), contents, length, etag,
                                   make_backup, flags, &new_etag, cancellable,
                                   &error);
 
+    pyg_block_threads();
+
     if (pyg_error_check(&error))
         return NULL;
 

Modified: trunk/gio/gio.defs
==============================================================================
--- trunk/gio/gio.defs	(original)
+++ trunk/gio/gio.defs	Mon Feb 16 21:10:32 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"))
@@ -1486,6 +1487,7 @@
   )
   (c-name "g_file_read")
   (return-type "GFileInputStream*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
@@ -1533,6 +1535,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"))
@@ -1545,6 +1548,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"))
@@ -1557,6 +1561,7 @@
   (of-object "GFile")
   (c-name "g_file_replace")
   (return-type "GFileOutputStream*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "etag")
@@ -1705,6 +1710,7 @@
   (of-object "GFile")
   (c-name "g_file_query_info")
   (return-type "GFileInfo*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "attributes")
@@ -1758,6 +1764,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")
@@ -1770,6 +1777,7 @@
   (of-object "GFile")
   (c-name "g_file_find_enclosing_mount")
   (return-type "GMount*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
@@ -1825,6 +1833,7 @@
   (of-object "GFile")
   (c-name "g_file_enumerate_children")
   (return-type "GFileEnumerator*")
+  (unblock-threads #t)
   (caller-owns-return #t)
   (parameters
     '("const-char*" "attributes")
@@ -1878,6 +1887,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")
@@ -1914,6 +1924,7 @@
   (of-object "GFile")
   (c-name "g_file_delete")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
     '("GError**" "error")
@@ -1924,6 +1935,7 @@
   (of-object "GFile")
   (c-name "g_file_trash")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
     '("GError**" "error")
@@ -2086,6 +2098,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")
@@ -2096,6 +2109,7 @@
   (of-object "GFile")
   (c-name "g_file_make_directory_with_parents")
   (return-type "gboolean")
+  (unblock-threads #t)
   (parameters
     '("GCancellable*" "cancellable")
     '("GError**" "error")
@@ -2106,6 +2120,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: trunk/gio/gio.override
==============================================================================
--- trunk/gio/gio.override	(original)
+++ trunk/gio/gio.override	Mon Feb 16 21:10:32 2009
@@ -240,8 +240,12 @@
   GList *list, *l;
   PyObject *ret;
 
+  pyg_unblock_threads();
+
   list = g_drive_get_volumes (G_DRIVE (self->obj));
 
+  pyg_block_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_unblock_threads();
+
     g_drive_poll_for_media(G_DRIVE(self->obj),
 			   cancellable,
 			   (GAsyncReadyCallback) async_result_callback_marshal,
 			   notify);
+    
+    pyg_block_threads();
 
     Py_INCREF(Py_None);
     return Py_None;
@@ -482,12 +490,16 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_unblock_threads();
+
     g_mount_unmount(G_MOUNT(self->obj),
 		    flags,
 		    cancellable,
 		    (GAsyncReadyCallback)async_result_callback_marshal,
 		    notify);
 
+    pyg_block_threads();
+
     Py_INCREF(Py_None);
     return Py_None;
 
@@ -530,12 +542,16 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_unblock_threads();
+
     g_mount_eject(G_MOUNT(self->obj),
 		  flags,
 		  cancellable,
 		  (GAsyncReadyCallback) async_result_callback_marshal,
 		  notify);
 
+    pyg_block_threads();
+
     Py_INCREF(Py_None);
     return Py_None;
 
@@ -592,6 +608,8 @@
 
     pygio_notify_reference_callback(notify);
 
+    pyg_unblock_threads();
+
     g_mount_remount(G_MOUNT(self->obj),
 		    flags,
 		    mount_operation,
@@ -599,6 +617,8 @@
 		    (GAsyncReadyCallback) async_result_callback_marshal,
 		    notify);
 
+    pyg_block_threads();
+
     Py_INCREF(Py_None);
     return Py_None;
 



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