[PATCH 4/5] quartzdrv: Add thread data management to the quartzdrv.

Pierre d'Herbemont pdherbemont at free.fr
Wed Oct 25 08:39:48 CDT 2006


---
   dlls/winequartz.drv/quartzdrv.h      |   48
++++++++++++++++++++++++++++++++++
   dlls/winequartz.drv/quartzdrv_main.c |   24 +++++++++++++++++
   2 files changed, 72 insertions(+), 0 deletions(-)

-------------- next part --------------
diff --git a/dlls/winequartz.drv/quartzdrv.h b/dlls/winequartz.drv/quartzdrv.h
new file mode 100644
index 0000000..4f97bb1
--- /dev/null
+++ b/dlls/winequartz.drv/quartzdrv.h
@@ -0,0 +1,48 @@
+/*
+ * Quartz driver definitions
+ *
+ * Copyright 1996 Alexandre Julliard
+ * Copyright 1999 Patrik Stridvall
+ * Copyright 2006 Emmanuel Maillard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#ifndef __WINE_QUARTZDRV_H
+#define __WINE_QUARTZDRV_H
+
+#ifndef __WINE_CONFIG_H
+# error You must include config.h to use this header
+#endif
+
+/* ---------------------------------------------------------------------
+   per-Thread data management
+*/
+struct quartzdrv_thread_data
+{
+	int		process_event_count;  /* recursion count for event processing */
+};
+
+extern struct quartzdrv_thread_data *quartzdrv_init_thread_data(void);
+extern DWORD thread_data_tls_index;
+
+inline static struct quartzdrv_thread_data *quartzdrv_thread_data(void)
+{
+    struct quartzdrv_thread_data *data = TlsGetValue( thread_data_tls_index );
+    if (!data) data = quartzdrv_init_thread_data();
+    return data;
+}
+
+#endif  /* __WINE_QUARTZDRV_H */
diff --git a/dlls/winequartz.drv/quartzdrv_main.c b/dlls/winequartz.drv/quartzdrv_main.c
index 52a04e6..c8b9442 100644
--- a/dlls/winequartz.drv/quartzdrv_main.c
+++ b/dlls/winequartz.drv/quartzdrv_main.c
@@ -28,8 +28,32 @@ #include "winreg.h"
 
 #include "wine/debug.h"
 
+#include "quartzdrv.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(quartzdrv);
 
+DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES;
+
+/***********************************************************************
+ *           QDRV thread initialisation routine
+ */
+struct quartzdrv_thread_data *quartzdrv_init_thread_data(void)
+{
+    struct quartzdrv_thread_data *data;
+    
+    if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) )))
+    {
+        ERR( "could not create data\n" );
+        ExitProcess(1);
+    }
+    
+    data->process_event_count = 0;
+
+    TlsSetValue( thread_data_tls_index, data );
+
+    return data;
+}
+
 /***********************************************************************
  *           process initialisation routine
  */


More information about the wine-patches mailing list