[svn] w32pth - r26 - trunk
svn author wk
cvs at cvs.gnupg.org
Mon Oct 13 13:32:01 CEST 2008
Author: wk
Date: 2008-10-13 13:32:00 +0200 (Mon, 13 Oct 2008)
New Revision: 26
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/pth.h
trunk/w32-pth.c
Log:
Re-implemented PTH_EVENT_HANDLE which was lost becuase I missed to commit
the changes back in 2007.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-27 11:51:42 UTC (rev 25)
+++ trunk/ChangeLog 2008-10-13 11:32:00 UTC (rev 26)
@@ -1,3 +1,11 @@
+2008-10-13 Werner Koch <wk at g10code.com>
+
+ * pth.h (PTH_EVENT_HANDLE): New. Note that this was orginally
+ implemented on 2007-11-20 but accidently not commited and thus
+ later lost.
+ * w32-pth.c (do_pth_event_body, do_pth_wait): Implement this event.
+ (do_pth_event_free): Do not close HD for a handle event.
+
2008-05-27 Werner Koch <wk at g10code.com>
* w32-pth.c (_pth_malloc, _pth_calloc, _pth_free): New. Always
@@ -67,13 +75,6 @@
about remaining issues.
(do_pth_event_body): Fix type in va_arg invocation.
-2007-11-20 Werner Koch <wk at g10code.com>
-
- * pth.h (PTH_EVENT_HANDLE): New.
- * w32-pth.c (struct pth_event_s): Add HANDLE.
- (do_pth_event_body, do_pth_wait): Implement handle event.
- (do_pth_event_free): Do not close HD for a handle event.
-
2007-08-16 Werner Koch <wk at g10code.com>
Released 2.0.1.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-05-27 11:51:42 UTC (rev 25)
+++ trunk/NEWS 2008-10-13 11:32:00 UTC (rev 26)
@@ -13,7 +13,9 @@
* New non-standard fucntion pth_thread_id.
+ * Add PTH_HANDLE_EVENT.
+
Noteworthy changes in version 2.0.1 (2007-08-16)
------------------------------------------------
@@ -27,7 +29,7 @@
to indicate the version of Pth we are emulating.
- Copyright 2007 g10 Code GmbH
+ Copyright 2007, 2008 g10 Code GmbH
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
Modified: trunk/pth.h
===================================================================
--- trunk/pth.h 2008-05-27 11:51:42 UTC (rev 25)
+++ trunk/pth.h 2008-10-13 11:32:00 UTC (rev 26)
@@ -103,8 +103,8 @@
#define PTH_EVENT_COND (1<<7)
#define PTH_EVENT_TID (1<<8)
#define PTH_EVENT_FUNC (1<<9)
+#define PTH_EVENT_HANDLE (1<<10) /* A generic waitable W32 HANDLE. */
-
/* Event occurrence restrictions. */
#define PTH_UNTIL_OCCURRED (1<<11)
#define PTH_UNTIL_FD_READABLE (1<<12)
Modified: trunk/w32-pth.c
===================================================================
--- trunk/w32-pth.c 2008-05-27 11:51:42 UTC (rev 25)
+++ trunk/w32-pth.c 2008-10-13 11:32:00 UTC (rev 26)
@@ -88,7 +88,9 @@
{
struct pth_event_s *next;
struct pth_event_s *prev;
- HANDLE hd; /* The event object. */
+ HANDLE hd; /* The event object. Note that this is
+ also used directly for the
+ PTH_EVENT_HANDLE event. */
int u_type; /* The type of the event. */
union
{
@@ -344,7 +346,7 @@
return h2;
}
-
+#if 0 /* Not yet used. */
static void
set_event (HANDLE h)
{
@@ -363,6 +365,7 @@
log_get_prefix (NULL), h);
}
}
+#endif
static void
reset_event (HANDLE h)
@@ -1379,6 +1382,7 @@
}
+#if 0 /* Not yet used. */
static BOOL WINAPI
sig_handler (DWORD signo)
{
@@ -1395,6 +1399,7 @@
fprintf (dbgfp, "%s: sig_handler=%d\n", log_get_prefix (NULL), pth_signo);
return TRUE;
}
+#endif
/* Helper to build an fdarray. */
@@ -1448,14 +1453,17 @@
return NULL;
ev->next = ev;
ev->prev = ev;
- if ((spec & PTH_EVENT_TIME))
- ev->hd = create_timer ();
- else
- ev->hd = create_event ();
- if (!ev->hd)
+ if ( !(spec & PTH_EVENT_HANDLE) )
{
- _pth_free (ev);
- return NULL;
+ if ((spec & PTH_EVENT_TIME))
+ ev->hd = create_timer ();
+ else
+ ev->hd = create_event ();
+ if (!ev->hd)
+ {
+ _pth_free (ev);
+ return NULL;
+ }
}
/* We don't support static yet but we need to consume the
@@ -1470,6 +1478,11 @@
if (spec == 0)
;
+ else if (spec & PTH_EVENT_HANDLE)
+ {
+ ev->u_type = PTH_EVENT_HANDLE;
+ ev->hd = va_arg (arg, void *);
+ }
else if (spec & PTH_EVENT_SIGS)
{
ev->u_type = PTH_EVENT_SIGS;
@@ -1696,7 +1709,8 @@
do
{
pth_event_t next = cur->next;
- CloseHandle (cur->hd);
+ if (cur->u_type != PTH_EVENT_HANDLE)
+ CloseHandle (cur->hd);
cur->hd = NULL;
_pth_free (cur);
cur = next;
@@ -1707,7 +1721,8 @@
{
ev->prev->next = ev->next;
ev->next->prev = ev->prev;
- CloseHandle (ev->hd);
+ if (ev->u_type != PTH_EVENT_HANDLE)
+ CloseHandle (ev->hd);
ev->hd = NULL;
_pth_free (ev);
}
@@ -1803,7 +1818,7 @@
while (r != ev);
/* Prepare all events which requires to launch helper threads for
- some types. This creates an array of handles which are lates
+ some types. This creates an array of handles which are later
passed to WFMO. */
pos = thlstidx = 0;
r = ev;
@@ -1920,6 +1935,12 @@
waitbuf[pos++] = r->hd;
break;
+ case PTH_EVENT_HANDLE:
+ TRACE_LOG ("adding handle event");
+ evarray[pos] = r;
+ waitbuf[pos++] = r->hd;
+ break;
+
case PTH_EVENT_MUTEX:
if (DBG_ERROR)
fprintf (dbgfp, "pth_wait: ignoring mutex event.\n");
More information about the Gnupg-commits
mailing list