[Gpg4win-commits] r107 - in trunk: . patches/glib patches/glib-2.6.6 patches/glib-2.8.4

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Wed Jan 4 22:52:53 CET 2006


Author: marcus
Date: 2006-01-04 22:52:53 +0100 (Wed, 04 Jan 2006)
New Revision: 107

Modified:
   trunk/ChangeLog
   trunk/patches/glib-2.6.6/01-giowin32.patch
   trunk/patches/glib-2.8.4/01-giowin32.patch
   trunk/patches/glib/01-giowin32.patch
Log:
2006-01-04  Marcus Brinkmann  <marcus at g10code.de>

	* patches/glib/01-giowin32.patch,
	patches/glib-2.6.6/01-giowin32.patch,
	patches/glib-2.8.4/01-giowin32.patch: Notify write thread about fd
	close.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-01-04 09:14:41 UTC (rev 106)
+++ trunk/ChangeLog	2006-01-04 21:52:53 UTC (rev 107)
@@ -1,3 +1,10 @@
+2006-01-04  Marcus Brinkmann  <marcus at g10code.de>
+
+	* patches/glib/01-giowin32.patch,
+	patches/glib-2.6.6/01-giowin32.patch,
+	patches/glib-2.8.4/01-giowin32.patch: Notify write thread about fd
+	close.
+
 2006-01-03  Marcus Brinkmann  <marcus at g10code.de>
 
 	* patches/glib-2.8.4/01-giowin32.patch: New file.

Modified: trunk/patches/glib/01-giowin32.patch
===================================================================
--- trunk/patches/glib/01-giowin32.patch	2006-01-04 09:14:41 UTC (rev 106)
+++ trunk/patches/glib/01-giowin32.patch	2006-01-04 21:52:53 UTC (rev 107)
@@ -49,7 +49,7 @@
        LOCK (channel->mutex);
  
        channel->revents = G_IO_IN;
-@@ -325,6 +333,121 @@
+@@ -325,6 +333,124 @@
    return 0;
  }
  
@@ -99,6 +99,9 @@
 +	  WaitForSingleObject (channel->space_avail_event, INFINITE);
 +
 +	  LOCK (channel->mutex);
++	  if (!channel->running)
++	    break;
++
 +	  if (channel->debug)
 +	    g_print ("write_thread %#x: rdp=%d, wrp=%d\n",
 +		     channel->thread_id, channel->rdp, channel->wrp);
@@ -171,7 +174,7 @@
  static void
  create_thread (GIOWin32Channel     *channel,
  	       GIOCondition         condition,
-@@ -341,6 +464,8 @@
+@@ -341,6 +467,8 @@
      g_warning (G_STRLOC ": Error closing thread handle: %s\n",
  	       g_win32_error_message (GetLastError ()));
  
@@ -180,7 +183,7 @@
    WaitForSingleObject (channel->space_avail_event, INFINITE);
  }
  
-@@ -474,6 +599,80 @@
+@@ -474,6 +602,80 @@
    return (*bytes_read > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
  }
  
@@ -261,7 +264,7 @@
  static unsigned __stdcall
  select_thread (void *parameter)
  {
-@@ -629,13 +828,27 @@
+@@ -629,13 +831,27 @@
    if (channel->type == G_IO_WIN32_FILE_DESC)
      {
        LOCK (channel->mutex);
@@ -294,7 +297,7 @@
        UNLOCK (channel->mutex);
      }
    else if (channel->type == G_IO_WIN32_SOCKET)
-@@ -968,6 +1181,12 @@
+@@ -968,6 +1184,12 @@
    GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
    gint result;
    
@@ -307,7 +310,19 @@
    result = write (win32_channel->fd, buf, count);
    if (win32_channel->debug)
      g_print ("g_io_win32_fd_write: fd:%d count:%d = %d\n",
-@@ -1086,7 +1305,9 @@
+@@ -1063,7 +1285,10 @@
+ 		 win32_channel->thread_id, win32_channel->fd);
+       win32_channel->running = FALSE;
+       win32_channel->needs_close = TRUE;
+-      SetEvent (win32_channel->data_avail_event);
++      if (win32_channel->direction == 0)
++	SetEvent (win32_channel->data_avail_event);
++      else
++	SetEvent (win32_channel->space_avail_event);
+     }
+   else
+     {
+@@ -1086,7 +1311,9 @@
  g_io_win32_fd_create_watch (GIOChannel    *channel,
  			    GIOCondition   condition)
  {
@@ -318,7 +333,7 @@
  }
  
  static GIOStatus
-@@ -1701,8 +1922,13 @@
+@@ -1701,8 +1928,13 @@
  
    if (win32_channel->thread_id == 0)
      {

Modified: trunk/patches/glib-2.6.6/01-giowin32.patch
===================================================================
--- trunk/patches/glib-2.6.6/01-giowin32.patch	2006-01-04 09:14:41 UTC (rev 106)
+++ trunk/patches/glib-2.6.6/01-giowin32.patch	2006-01-04 21:52:53 UTC (rev 107)
@@ -49,7 +49,7 @@
        LOCK (channel->mutex);
  
        channel->revents = G_IO_IN;
-@@ -325,6 +333,121 @@
+@@ -325,6 +333,124 @@
    return 0;
  }
  
@@ -99,6 +99,9 @@
 +	  WaitForSingleObject (channel->space_avail_event, INFINITE);
 +
 +	  LOCK (channel->mutex);
++	  if (!channel->running)
++	    break;
++
 +	  if (channel->debug)
 +	    g_print ("write_thread %#x: rdp=%d, wrp=%d\n",
 +		     channel->thread_id, channel->rdp, channel->wrp);
@@ -171,7 +174,7 @@
  static void
  create_thread (GIOWin32Channel     *channel,
  	       GIOCondition         condition,
-@@ -341,6 +464,8 @@
+@@ -341,6 +467,8 @@
      g_warning (G_STRLOC ": Error closing thread handle: %s\n",
  	       g_win32_error_message (GetLastError ()));
  
@@ -180,7 +183,7 @@
    WaitForSingleObject (channel->space_avail_event, INFINITE);
  }
  
-@@ -474,6 +599,80 @@
+@@ -474,6 +602,80 @@
    return (*bytes_read > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
  }
  
@@ -261,7 +264,7 @@
  static unsigned __stdcall
  select_thread (void *parameter)
  {
-@@ -629,13 +828,27 @@
+@@ -629,13 +831,27 @@
    if (channel->type == G_IO_WIN32_FILE_DESC)
      {
        LOCK (channel->mutex);
@@ -294,7 +297,7 @@
        UNLOCK (channel->mutex);
      }
    else if (channel->type == G_IO_WIN32_SOCKET)
-@@ -968,6 +1181,12 @@
+@@ -968,6 +1184,12 @@
    GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
    gint result;
    
@@ -307,7 +310,19 @@
    result = write (win32_channel->fd, buf, count);
    if (win32_channel->debug)
      g_print ("g_io_win32_fd_write: fd:%d count:%d = %d\n",
-@@ -1086,7 +1305,9 @@
+@@ -1063,7 +1285,10 @@
+ 		 win32_channel->thread_id, win32_channel->fd);
+       win32_channel->running = FALSE;
+       win32_channel->needs_close = TRUE;
+-      SetEvent (win32_channel->data_avail_event);
++      if (win32_channel->direction == 0)
++	SetEvent (win32_channel->data_avail_event);
++      else
++	SetEvent (win32_channel->space_avail_event);
+     }
+   else
+     {
+@@ -1086,7 +1311,9 @@
  g_io_win32_fd_create_watch (GIOChannel    *channel,
  			    GIOCondition   condition)
  {
@@ -318,7 +333,7 @@
  }
  
  static GIOStatus
-@@ -1701,8 +1922,13 @@
+@@ -1701,8 +1928,13 @@
  
    if (win32_channel->thread_id == 0)
      {

Modified: trunk/patches/glib-2.8.4/01-giowin32.patch
===================================================================
--- trunk/patches/glib-2.8.4/01-giowin32.patch	2006-01-04 09:14:41 UTC (rev 106)
+++ trunk/patches/glib-2.8.4/01-giowin32.patch	2006-01-04 21:52:53 UTC (rev 107)
@@ -49,7 +49,7 @@
        LOCK (channel->mutex);
  
        channel->revents = G_IO_IN;
-@@ -486,6 +494,121 @@ read_thread (void *parameter)
+@@ -486,6 +494,124 @@ read_thread (void *parameter)
    return 0;
  }
  
@@ -99,6 +99,9 @@
 +	  WaitForSingleObject (channel->space_avail_event, INFINITE);
 +
 +	  LOCK (channel->mutex);
++	  if (!channel->running)
++	    break;
++
 +	  if (channel->debug)
 +	    g_print ("write_thread %#x: rdp=%d, wrp=%d\n",
 +		     channel->thread_id, channel->rdp, channel->wrp);
@@ -171,7 +174,7 @@
  static void
  create_thread (GIOWin32Channel     *channel,
  	       GIOCondition         condition,
-@@ -502,6 +625,8 @@ create_thread (GIOWin32Channel     *chan
+@@ -502,6 +628,8 @@ create_thread (GIOWin32Channel     *chan
      g_warning (G_STRLOC ": Error closing thread handle: %s\n",
  	       g_win32_error_message (GetLastError ()));
  
@@ -180,7 +183,7 @@
    WaitForSingleObject (channel->space_avail_event, INFINITE);
  }
  
-@@ -575,6 +700,79 @@ buffer_read (GIOWin32Channel *channel,
+@@ -575,6 +703,79 @@ buffer_read (GIOWin32Channel *channel,
    return (*bytes_read > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
  }
  
@@ -260,7 +263,7 @@
  static gboolean
  g_io_win32_prepare (GSource *source,
  		    gint    *timeout)
-@@ -601,13 +799,27 @@ g_io_win32_prepare (GSource *source,
+@@ -601,13 +802,27 @@ g_io_win32_prepare (GSource *source,
  		 condition_to_string (channel->revents));
        
        LOCK (channel->mutex);
@@ -293,7 +296,7 @@
        UNLOCK (channel->mutex);
        break;
  
-@@ -965,6 +1177,12 @@ g_io_win32_fd_write (GIOChannel  *channe
+@@ -965,6 +1180,12 @@ g_io_win32_fd_write (GIOChannel  *channe
    GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
    gint result;
    
@@ -306,7 +309,19 @@
    result = write (win32_channel->fd, buf, count);
    if (win32_channel->debug)
      g_print ("g_io_win32_fd_write: fd=%d count=%d => %d\n",
-@@ -1105,7 +1323,12 @@ g_io_win32_fd_create_watch (GIOChannel  
+@@ -1061,7 +1282,10 @@ g_io_win32_fd_close (GIOChannel *channel
+ 		 win32_channel->thread_id, win32_channel->fd);
+       win32_channel->running = FALSE;
+       win32_channel->needs_close = TRUE;
+-      SetEvent (win32_channel->data_avail_event);
++      if (win32_channel->direction == 0)
++	SetEvent (win32_channel->data_avail_event);
++      else
++	SetEvent (win32_channel->space_avail_event);
+     }
+   else
+     {
+@@ -1105,7 +1329,12 @@ g_io_win32_fd_create_watch (GIOChannel  
  
    LOCK (win32_channel->mutex);
    if (win32_channel->thread_id == 0)
@@ -320,7 +335,7 @@
  
    g_source_add_poll (source, &watch->pollfd);
    UNLOCK (win32_channel->mutex);
-@@ -1715,8 +1938,13 @@ g_io_channel_win32_make_pollfd (GIOChann
+@@ -1715,8 +1944,13 @@ g_io_channel_win32_make_pollfd (GIOChann
  
        fd->fd = (gint) win32_channel->data_avail_event;
  



More information about the Gpg4win-commits mailing list