Changeset 1939


Ignore:
Timestamp:
Apr 22, 2008 10:38:46 PM (16 years ago)
Author:
bennylp
Message:

Workaround for pj_thread_sleep() failure with ETIMEDOUT in MacOS X (thanks Daniel Mikusa)

File:
1 edited

Legend:

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

    r1842 r1939  
    706706    usleep(msec * 1000); 
    707707 
     708    /* MacOS X (reported on 10.5) seems to always set errno to ETIMEDOUT. 
     709     * It does so because usleep() is declared to return int, and we're 
     710     * supposed to check for errno only when usleep() returns non-zero.  
     711     * Unfortunately, usleep() is declared to return void in other platforms 
     712     * so it's not possible to always check for the return value (unless  
     713     * we add a detection routine in autoconf). 
     714     * 
     715     * As a workaround, here we check if ETIMEDOUT is returned and 
     716     * return successfully if it is. 
     717     */ 
     718    if (pj_get_native_os_error() == ETIMEDOUT) 
     719        return PJ_SUCCESS; 
     720 
    708721    return pj_get_os_error(); 
    709 ; 
     722 
    710723#endif  /* PJ_RTEMS */ 
    711724} 
Note: See TracChangeset for help on using the changeset viewer.