Ignore:
Timestamp:
Feb 7, 2008 1:11:39 PM (14 years ago)
Author:
bennylp
Message:

Ticket #470, #471, and #472: Compile error when semaphore.h is not present, Compilation error if pthread_mutexattr_set_type() is not present, and Problem with setting up FD_SETSIZE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/os_core_unix.c

    r1589 r1783  
    3535#include <pj/errno.h> 
    3636 
    37 #if defined(PJ_HAS_SEMAPHORE) && PJ_HAS_SEMAPHORE != 0 
     37#if defined(PJ_HAS_SEMAPHORE_H) && PJ_HAS_SEMAPHORE_H != 0 
    3838#  include <semaphore.h> 
    3939#endif 
     
    949949 
    950950    if (type == PJ_MUTEX_SIMPLE) { 
    951 #if defined(PJ_LINUX) && PJ_LINUX!=0 
     951#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 
     952    defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE) 
    952953        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP); 
    953 #elif defined(PJ_RTEMS) && PJ_RTEMS!=0 
     954#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \ 
     955       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE) 
    954956        /* Nothing to do, default is simple */ 
    955957#else 
     
    957959#endif 
    958960    } else { 
    959 #if defined(PJ_LINUX) && PJ_LINUX!=0 
     961#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 
     962     defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE) 
    960963        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); 
    961 #elif defined(PJ_RTEMS) && PJ_RTEMS!=0 
     964#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \ 
     965       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE) 
    962966        // Phil Torre <ptorre@zetron.com>: 
    963967        // The RTEMS implementation of POSIX mutexes doesn't include  
    964968        // pthread_mutexattr_settype(), so what follows is a hack 
    965969        // until I get RTEMS patched to support the set/get functions. 
     970        // 
     971        // More info: 
     972        //   newlib's pthread also lacks pthread_mutexattr_settype(), 
     973        //   but it seems to have mutexattr.recursive. 
    966974        PJ_TODO(FIX_RTEMS_RECURSIVE_MUTEX_TYPE) 
    967975        attr.recursive = 1; 
     
    12401248 */ 
    12411249#if defined(PJ_EMULATE_RWMUTEX) && PJ_EMULATE_RWMUTEX!=0 
    1242 #  include "os_rwmutex.c" 
     1250    /* We need semaphore functionality to emulate rwmutex */ 
     1251#   if !defined(PJ_HAS_SEMAPHORE) || PJ_HAS_SEMAPHORE==0 
     1252#       error "Semaphore support needs to be enabled to emulate rwmutex" 
     1253#   endif 
     1254#   include "os_rwmutex.c" 
    12431255#else 
    12441256struct pj_rwmutex_t 
Note: See TracChangeset for help on using the changeset viewer.