Chris,

while the cancel event creation looks good now i would make sure that
the process is created only when the handles are valid.

Thomas

2003-15-15  Thomas Pfaff  <[EMAIL PROTECTED]>

        * thread.cc (pthread::init_main_thread): Make sure that the
        main thread has valid handles.
        (pthread::create_cancel_event): Fix error message.
diff -urp src.old/thread.cc src/thread.cc
--- src.old/thread.cc   2003-12-15 09:03:44.934379200 +0100
+++ src/thread.cc       2003-12-15 13:15:50.826995200 +0100
@@ -231,9 +231,10 @@ pthread::init_mainthread ()
   if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
                        GetCurrentProcess (), &thread->win32_obj_id,
                        0, FALSE, DUPLICATE_SAME_ACCESS))
-    thread->win32_obj_id = NULL;
+    api_fatal ("failed to create mainthread handle");
   thread->set_tls_self_pointer ();
-  (void) thread->create_cancel_event ();
+  if (!thread->create_cancel_event ())
+    api_fatal ("couldn't create cancel event for main thread");
   thread->postcreate ();
 }
 
@@ -289,7 +290,7 @@ pthread::create_cancel_event ()
   cancel_event = ::CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
   if (!cancel_event)
     {
-      system_printf ("couldn't create cancel event for main thread, %E");
+      system_printf ("couldn't create cancel event for thread, %E");
       /* we need the event for correct behaviour */
       return false;
     }

Reply via email to