`

Cygwin中交叉编译pthread_mutex_timedlock问题

阅读更多

今天编译Linux文件,遇到错误

pthread_mutex_timedlock was not declared in this scope

 

网上查了下:

原文:http://stackoverflow.com/questions/3414834/gcc-stdthread-not-found-in-namespace-std

 

Works fine on Linux (g++ -std=c++0x -lpthread with no additional defines).

However, this thread on Cygwin mailing list suggests that, at least as of 4.4, _GLIBCXX_HAS_GTHREADS was disabled by an autoconf test when building libstdc++ because pthread implementation of cygwin is missing pthread_mutex_timedlock. Perhaps MinGW has the same problem.

Also, this thread on comp.lang.c++.moderated says the same thing. Not supported by the library.

 

原来Cygwin中gcc gcc-4.4.3以上就开始不支持 pthread_mutex_timedlock

 

即使加上参数 -std=c++0x -lpthread (在Linux可以正常)也无用

 

分享到:
评论

相关推荐

    Pthread线程包 Windows移植版

    - **互斥锁(Mutex)**:`pthread_mutex_t`用于保护共享资源,确保同一时间只有一个线程能访问。 - **条件变量(Condition Variable)**:`pthread_cond_t`允许线程等待某个条件满足后继续执行。 - **信号量...

    windows VS2010编译最新pthreads-w32-2-9-1静态库

    例如,可以使用`pthread_create()`创建线程,`pthread_join()`等待线程结束,`pthread_mutex_lock()`和`pthread_mutex_unlock()`处理线程同步等。 在编译过程中可能会遇到一些问题,比如配置不正确导致的链接错误,...

    cygwin—api

    - **Synchronization**:同步机制,如`pthread_mutex_lock`, `pthread_cond_wait`等。 - **Memory Management**:内存管理,如`mmap`, `munmap`等。 - **Thread Management**:线程管理,如`pthread_create`, `...

    pthreads-w32-2-8-0-release

    `pthread`是Posix标准的一部分,它提供了一组用于创建、同步和管理线程的函数,包括`pthread_create()`用于创建新线程,`pthread_join()`用于等待线程结束,以及`pthread_mutex_t`和`pthread_cond_t`等用于线程间...

    pthread.h sched.h semaphore.h 三个头文件

    `pthread.h`中的关键函数包括`pthread_create()`用于创建新线程,`pthread_join()`等待线程结束,以及`pthread_mutex_t`等同步原语,用于线程间的通信和互斥访问资源。 2. **sched.h**: 此头文件提供了调度相关的...

Global site tag (gtag.js) - Google Analytics