Build MSVC libraries with Boost Threads instead of Pthreads
-----------------------------------------------------------

                 Key: THRIFT-1387
                 URL: https://issues.apache.org/jira/browse/THRIFT-1387
             Project: Thrift
          Issue Type: Improvement
          Components: C++ - Library
    Affects Versions: 0.8
         Environment: Windows - Visual Studio
            Reporter: Peace C
            Priority: Minor
             Fix For: 0.8
         Attachments: THRIFT-1387_BoostThreadsWin.patch

This patch is based on Alex's Boost threads patch (THRIFT-1361) and adds 
support in the MSVC project to build with Boost threads instead of Pthreads. 
The option is configurable using "#define HAVE_PTHREAD_H" in 
thrift/lib/cpp/src/windows/config.h (default is to build using Boost threads). 
In order to support building either way, I wrapped #if(n)def USE_BOOST_THREAD 
around Monitor.cpp, Mutex.cpp, PosixThreadFactory.cpp and their analogous Boost 
versions (BoostMonitor.cpp, BoostMutex.cpp, BoostThreadFactory.cpp).

Remember that any code calling errno should add force_inc.h to the project's 
Force Include list. This tripped me up in TNonblockingServer.cpp when errno 
would always return 0.  Using the project properties is more opaque but we 
can't add force_inc.h to config.h because any project using the thrift library 
will get the forced redefinitions (not good if the app expects the MS SDK 
definitions). 

I also adjusted the thrift library projects to generate appropriately named pdb 
files. They were defaulting to vc100.pdb, causing one project's build to stomp 
over the other's pdb.

The patch was created using TortoiseHg workbench. Please notify me if the 
format isn't compatible with the Thrift team's patch tool and I will modify the 
patch accordingly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to