You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 2000/07/08 06:50:51 UTC

[PATCH] winnt thread_id

thread_id is used in several places as a type, but in one place as
a variable name.  I'd like to replace this using the below patch,
but I have no way of testing it at the moment.

....Roy

Index: mpm_winnt.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.85
diff -u -r1.85 mpm_winnt.c
--- mpm_winnt.c	2000/07/06 17:48:41	1.85
+++ mpm_winnt.c	2000/07/08 04:47:10
@@ -1171,7 +1171,7 @@
     HANDLE child_events[2];
     char* exit_event_name;
     int nthreads = ap_threads_per_child;
-    int thread_id;
+    ap_os_thread_t tid;
     thread **child_handles;
     int rv;
     time_t end_time;
@@ -1238,14 +1238,14 @@
     child_handles = (thread *) alloca(nthreads * sizeof(int));
     for (i = 0; i < nthreads; i++) {
         child_handles[i] = (thread *) _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) worker_main,
-                                                     NULL, 0, &thread_id);
+                                                     NULL, 0, &tid);
     }
 
     /* Begin accepting connections */
     if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
         /* Win95/98: Start the accept thread */
         _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) accept_and_queue_connections,
-                       (void *) i, 0, &thread_id);
+                       (void *) i, 0, &tid);
     } else {
         /* Windows NT/2000: Create AcceptEx completion contexts */
         create_listeners();

Re: [PATCH] winnt thread_id

Posted by Bill Stoddard <re...@attglobal.net>.
No quite.  ap_os_thread_id is a HANDLE which is a void * on Windows. _beginthreadex takes an int.

_beginthreadex is not the 'native' way to create a thread on Windows but is preferred over the
native CreateThread if you use C runtime library calls (required for proper cleanup during atexit.)

Bill

> thread_id is used in several places as a type, but in one place as
> a variable name.  I'd like to replace this using the below patch,
> but I have no way of testing it at the moment.
>
> ....Roy
>
> Index: mpm_winnt.c
> ===================================================================
> RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/mpm_winnt.c,v
> retrieving revision 1.85
> diff -u -r1.85 mpm_winnt.c
> --- mpm_winnt.c 2000/07/06 17:48:41 1.85
> +++ mpm_winnt.c 2000/07/08 04:47:10
> @@ -1171,7 +1171,7 @@
>      HANDLE child_events[2];
>      char* exit_event_name;
>      int nthreads = ap_threads_per_child;
> -    int thread_id;
> +    ap_os_thread_t tid;
>      thread **child_handles;
>      int rv;
>      time_t end_time;
> @@ -1238,14 +1238,14 @@
>      child_handles = (thread *) alloca(nthreads * sizeof(int));
>      for (i = 0; i < nthreads; i++) {
>          child_handles[i] = (thread *) _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE)
worker_main,
> -                                                     NULL, 0, &thread_id);
> +                                                     NULL, 0, &tid);
>      }
>
>      /* Begin accepting connections */
>      if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
>          /* Win95/98: Start the accept thread */
>          _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) accept_and_queue_connections,
> -                       (void *) i, 0, &thread_id);
> +                       (void *) i, 0, &tid);
>      } else {
>          /* Windows NT/2000: Create AcceptEx completion contexts */
>          create_listeners();
>