Ticket #8817: wince.patch

File wince.patch, 3.8 KB (added by Andrew Ho <helloworld922@…>, 9 years ago)

patch which fixes boost threads and also moves wince configs to win32.hpp

  • boost/config/compiler/visualc.hpp

     
    108108#  define BOOST_NO_CXX11_VARIADIC_MACROS
    109109#endif
    110110
    111 #if defined(UNDER_CE)
    112 // Windows CE does not have a conforming signature for swprintf
    113 #  define BOOST_NO_SWPRINTF
    114 #endif
    115 
    116111#if _MSC_VER < 1500  // 140X == VC++ 8.0
    117112#  define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
    118113#endif
     
    142137#  define BOOST_NO_INTRINSIC_WCHAR_T
    143138#endif
    144139
    145 #if defined(_WIN32_WCE) || defined(UNDER_CE)
    146 #  define BOOST_NO_SWPRINTF
    147 #endif
    148 
    149 // we have ThreadEx or GetSystemTimeAsFileTime unless we're running WindowsCE
    150 #if !defined(_WIN32_WCE) && !defined(UNDER_CE)
    151 #  define BOOST_HAS_THREADEX
    152 #  define BOOST_HAS_GETSYSTEMTIMEASFILETIME
    153 #endif
    154 
    155140//
    156141// check for exception handling support:
    157142#if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
  • boost/config/platform/win32.hpp

     
    6161#  define BOOST_HAS_GETSYSTEMTIMEASFILETIME
    6262#endif
    6363
     64#if defined(_WIN32_WCE) || defined(UNDER_CE)
     65// Windows CE does not have a conforming signature for swprintf
     66#  define BOOST_NO_SWPRINTF
     67#endif
     68
     69// we have ThreadEx or GetSystemTimeAsFileTime unless we're running WindowsCE
     70#if !defined(_WIN32_WCE) && !defined(UNDER_CE)
     71#  define BOOST_HAS_THREADEX
     72#  define BOOST_HAS_GETSYSTEMTIMEASFILETIME
     73#endif
     74
    6475#ifndef BOOST_HAS_PTHREADS
    6576#  define BOOST_HAS_WINTHREADS
    6677#endif
  • libs/thread/src/win32/thread.cpp

     
    111111    namespace
    112112    {
    113113#ifndef BOOST_HAS_THREADEX
    114 // Windows CE doesn't define _beginthreadex
    115 
    116         struct ThreadProxyData
    117         {
    118             typedef unsigned (__stdcall* func)(void*);
    119             func start_address_;
    120             void* arglist_;
    121             ThreadProxyData(func start_address,void* arglist) : start_address_(start_address), arglist_(arglist) {}
    122         };
    123 
    124         DWORD WINAPI ThreadProxy(LPVOID args)
    125         {
    126             std::auto_ptr<ThreadProxyData> data(reinterpret_cast<ThreadProxyData*>(args));
    127             DWORD ret=data->start_address_(data->arglist_);
    128             return ret;
    129         }
    130 
    131         typedef void* uintptr_t;
    132 
    133         inline uintptr_t _beginthreadex(void* security, unsigned stack_size, unsigned (__stdcall* start_address)(void*),
    134                                               void* arglist, unsigned initflag, unsigned* thrdaddr)
    135         {
    136             DWORD threadID;
    137             ThreadProxyData* data = new ThreadProxyData(start_address,arglist);
    138             HANDLE hthread=CreateThread(static_cast<LPSECURITY_ATTRIBUTES>(security),stack_size,ThreadProxy,
    139                                         data,initflag,&threadID);
    140             if (hthread==0) {
    141               delete data;
    142               return 0;
    143             }
    144             *thrdaddr=threadID;
    145             return reinterpret_cast<uintptr_t const>(hthread);
    146         }
    147 
    148 #endif
    149 
     114#define _beginthreadex(security, \
     115                       stack_size, \
     116                       start_proc, \
     117                       arg, \
     118                       flags, \
     119                       pid) \
     120        CreateThread(security, \
     121                     stack_size, \
     122                     (LPTHREAD_START_ROUTINE) start_proc, \
     123                     arg, \
     124                     flags, \
     125                     pid)
     126#endif // !BOOST_HAS_THREADEX
    150127    }
    151128
    152129    namespace detail