Ignore:
Timestamp:
Jul 1, 2010, 3:59:06 AM (11 years ago)
Author:
charles
Message:

(trunk libT) #3381 "replace calls to usleep() with calls to nanosleep()" -- done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r10912 r10916  
    2929#include <stdlib.h>
    3030#include <string.h> /* strerror(), memset(), memmem() */
     31#include <time.h> /* nanosleep() */
    3132
    3233#include <libgen.h> /* basename() */
     
    3435#include <sys/types.h>
    3536#include <sys/stat.h>
    36 #include <unistd.h> /* usleep(), stat(), getcwd(), getpagesize() */
     37#include <unistd.h> /* stat(), getcwd(), getpagesize() */
    3738
    3839#include "event.h"
     
    790791
    791792void
    792 tr_wait_msec( uint64_t delay_milliseconds )
     793tr_wait_msec( long int msec )
    793794{
    794795#ifdef WIN32
    795     Sleep( (DWORD)delay_milliseconds );
     796    Sleep( (DWORD)msec );
    796797#else
    797     usleep( 1000 * delay_milliseconds );
     798    struct timespec ts;
     799    ts.tv_sec = msec / 1000;
     800    ts.tv_sec = ( msec % 1000 ) * 1000000;
     801    nanosleep( &ts, NULL );
    798802#endif
    799803}
Note: See TracChangeset for help on using the changeset viewer.