win32-name-event-objects-20040228
[openafs.git] / src / WINNT / pthread / pthread.c
index 4c72ab6..0c8918d 100644 (file)
@@ -587,11 +587,15 @@ static DWORD WINAPI terminate_thread_routine(LPVOID param) {
 
 
 static void pthread_sync_terminate_thread(void) {
+
     (pthread_cache_done || pthread_once(&pthread_cache_once, create_once));
 
     if (terminate_thread_handle == INVALID_HANDLE_VALUE) {
+        CHAR eventName[MAX_PATH];
+        static eventCount = 0;
+        sprintf(eventName, "pthread terminate thread %d", eventCount++);
        terminate_thread_wakeup_event = CreateEvent((LPSECURITY_ATTRIBUTES) 0,
-                               TRUE, FALSE, (LPCTSTR) 0);
+                               TRUE, FALSE, (LPCTSTR) eventName);
        terminate_thread_handle = CreateThread((LPSECURITY_ATTRIBUTES) 0, 0, 
                                terminate_thread_routine, (LPVOID) 0, 0, 
                                &terminate_thread_id);
@@ -711,8 +715,11 @@ static cond_waiters_t *get_waiter() {
     if (queue_IsEmpty(&waiter_cache)) {
         new = (cond_waiters_t *) malloc(sizeof(cond_waiters_t));
        if (new != NULL) {
+        CHAR eventName[MAX_PATH];
+        static eventCount = 0;
+        sprintf(eventName, "cond_waiters_t %d", eventCount++);
            new->event = CreateEvent((LPSECURITY_ATTRIBUTES) 0, FALSE,
-                                    FALSE, (LPCTSTR) 0);
+                                    FALSE, (LPCTSTR) eventName);
            if (new->event == NULL) {
                free(new);
                new = NULL;