Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
Windows, MinGW/MSYS2, GCC 6.2.0
Description
Compiling 7ab125a253e5aebbf2a0ed9a0a1602a4b879eca7 under MinGW/MSYS2 with GCC 6.2.0:
src/thrift/concurrency/PosixThreadFactory.cpp: In member function 'virtual apache::thrift::concurrency::Thread::id_t apache::thrift::concurrency::PthreadThread::getId()': src/thrift/concurrency/PosixThreadFactory.cpp:177:35: error: request for member 'p' in '((apache::thrift::concurrency::PthreadThread*)this)->apache::thrift::concurrency::PthreadThread::pthread_', which is of non-class type 'pthread_t {aka long long unsigned int}' return (Thread::id_t)pthread_.p;
src/thrift/concurrency/PosixThreadFactory.cpp: In member function 'virtual apache::thrift::concurrency::Thread::id_t apache::thrift::concurrency::PosixThreadFactory::getCurrentThreadId() const': src/thrift/concurrency/PosixThreadFactory.cpp:311:39: error: request for member 'p' in 'pthread_self()', which is of non-class type 'pthread_t {aka long long unsigned int}' return (Thread::id_t)pthread_self().p;
Under MinGW, pthread_t is default POSIX, but _WIN32 is defined, so the following pre-processor switches don't work correctly in this case:
Thread::id_t getId() { #ifndef _WIN32 return (Thread::id_t)pthread_; #else return (Thread::id_t)pthread_.p; #endif // _WIN32 }
Thread::id_t PosixThreadFactory::getCurrentThreadId() const { #ifndef _WIN32 return (Thread::id_t)pthread_self(); #else return (Thread::id_t)pthread_self().p; #endif // _WIN32 }
Attachments
Issue Links
- is superceded by
-
THRIFT-4046 MinGW with gcc 6.2 does not compile on Windows
- Closed