name-event-objects-20040301
[openafs.git] / src / WINNT / pthread / pthread.c
index 8be02f0..00d034a 100644 (file)
@@ -1,7 +1,13 @@
 /*
- * Copyright (C)  1999, 1998  Transarc Corporation.  All rights reserved.
- *
- *
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ * 
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+/*
  * This file contains a skeleton pthread implementation for NT.
  * This is not intended to be a fully compliant pthread implementation
  * The purpose of this file is to only implement those functions that
@@ -704,14 +710,22 @@ static cond_waiters_t *get_waiter() {
  
     if (queue_IsEmpty(&waiter_cache)) {
         new = (cond_waiters_t *) malloc(sizeof(cond_waiters_t));
-       if (new != NULL) {
-           new->event = CreateEvent((LPSECURITY_ATTRIBUTES) 0, FALSE,
-                                    FALSE, (LPCTSTR) 0);
-           if (new->event == NULL) {
-               free(new);
-               new = NULL;
-           }
-       }
+        if (new != NULL) {
+#if 1
+            CHAR eventName[MAX_PATH];
+            static eventCount = 0;
+            sprintf(eventName, "cond_waiters_t %d::%d", _getpid(), eventCount++);
+            new->event = CreateEvent((LPSECURITY_ATTRIBUTES) 0, FALSE,
+                                      FALSE, (LPCTSTR) eventName);
+#else
+            new->event = CreateEvent((LPSECURITY_ATTRIBUTES) 0, FALSE,
+                                      FALSE, (LPCTSTR) 0);
+            if (new->event == NULL) {
+                free(new);
+                new = NULL;
+            }
+#endif
+        }
     } else {
         new = queue_First(&waiter_cache, cond_waiter);
         queue_Remove(new);
@@ -719,7 +733,6 @@ static cond_waiters_t *get_waiter() {
  
     LeaveCriticalSection(&waiter_cache_cs);
     return new;
 }
  
 static void put_waiter(cond_waiters_t *old) {