apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/threadproc/win32 thread.c
Date Tue, 12 Feb 2002 01:24:12 GMT
wrowe       02/02/11 17:24:12

  Modified:    threadproc/win32 thread.c
  Log:
    Another fine patch from Mladen Turk <mturk@mappingsoft.com>, since WinCE
    doesn't use the same clib conventions as the rest of the Win32 platforms,
    we can't protect the clib space with the _beginthreadex/_endthread
    conventions - fall back on the native API.
  
  Revision  Changes    Path
  1.43      +17 -2     apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/thread.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- thread.c	28 Dec 2001 23:58:39 -0000	1.42
  +++ thread.c	12 Feb 2002 01:24:12 -0000	1.43
  @@ -58,7 +58,9 @@
   #include "apr_general.h"
   #include "apr_lib.h"
   #include "apr_portable.h"
  +#if APR_HAVE_PROCESS_H
   #include <process.h>
  +#endif
   #include "misc.h"   
   
   APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
  @@ -121,12 +123,19 @@
       /* Use 0 for Thread Stack Size, because that will default the stack to the
        * same size as the calling thread. 
        */
  +#ifndef _WIN32_WCE
       if (((*new)->td = (HANDLE *)_beginthreadex(NULL, 0, 
                           (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
                           (*new), 0, &temp)) == 0) {
           return APR_FROM_OS_ERROR(_doserrno);
       }
  -
  +#else
  +   if (((*new)->td = (HANDLE *)CreateThread(NULL, 0, 
  +                        (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
  +                        (*new), 0, &temp)) == 0) {
  +        return apr_get_os_error();
  +    }
  +#endif
       if (attr && attr->detach) {
           CloseHandle((*new)->td);
       }
  @@ -139,8 +148,12 @@
   {
       thd->exitval = retval;
       apr_pool_destroy(thd->cntxt);
  +#ifndef _WIN32_WCE
       _endthreadex(0);
  -	return APR_SUCCESS;
  +#else
  +    ExitThread(0);
  +#endif
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
  @@ -174,9 +187,11 @@
        * providing more critical threads a bit larger timeslice)
        * we won't worry too much if it's not available.
        */
  +#ifndef _WIN32_WCE
       if (apr_os_level >= APR_WIN_NT) {
           SwitchToThread();
       }
  +#endif
   }
   
   APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
  
  
  

Mime
View raw message