Timed_mutex will not compile under Cygwin 4.8.2 ('timed_mutex' in the namespace 'std' does not name the type)

My file test8.cppis

#include<thread>
#include<mutex>
#include<chrono>

std::mutex mutex;
std::timed_mutex timed_mutex;

When I compile this code

g++ -std=c++11 -pthread -c test8.cpp

he tells me

timed_mutex in namespace 'std' does not name type

I am compiling under Cygwin64, gcc version 4.8.2

screenshot

==================================================== =================

@ Jonathan Wackel

enter image description here

+4
source share
1 answer

A type is timed_mutexdetermined only if the platform supports it. GCC preprocessor conditions <mutex>are:

#ifdef _GLIBCXX_USE_C99_STDINT_TR1

, <stdint.h>

#if _GTHREAD_USE_MUTEX_TIMEDLOCK

, _POSIX_TIMEOUTS <unistd.h>.

, std::mutex, , undefined, , Cygwin Pthreads Timeouts.

, -, :

#include <unistd.h>
// In case of POSIX threads check _POSIX_TIMEOUTS.
#if (defined(_PTHREADS) \
    && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
#error
#endif
int main() { }

Cygwin . Cygwin Timeouts, , GCC, timed_mutex Cygwin.

: GCC 6 std::timed_mutex , _POSIX_TIMEOUTS. , Cygwin .

+2

All Articles