[f-spot: 28/40] ensure the first BeginRead is async



commit eca761a7d0ad710cb13932bc817658d7fcedfd81
Author: Stephane Delcroix <stephane delcroix org>
Date:   Mon Jun 22 14:37:44 2009 +0200

    ensure the first BeginRead is async
    
    The BeginRead was completing synchronously as there was enough bytes in the stream for it to complete. We want to enfore this being async as the expensive part is not reading from stream (in case of file stream), but feeding the pixbufloader

 src/ImageLoader.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/ImageLoader.cs b/src/ImageLoader.cs
index 66afea6..f967129 100644
--- a/src/ImageLoader.cs
+++ b/src/ImageLoader.cs
@@ -10,6 +10,7 @@
 //
 
 using System;
+using System.Threading;
 using Gdk;
 using FSpot.Utils;
 using FSpot.Platform;
@@ -69,7 +70,9 @@ namespace FSpot {
 				image_stream = image_file.PixbufStream ();
 				pixbuf_orientation = image_file.Orientation;
 			}
-			image_stream.BeginRead (buffer, 0, count, HandleReadDone, null);
+			image_stream.BeginRead (buffer, 0, count, delegate (IAsyncResult r) {
+				ThreadPool.QueueUserWorkItem (delegate {HandleReadDone (r);});
+			}, null);
 			loading = true;
 		}
 



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