Changeset 10929


Ignore:
Timestamp:
Jul 2, 2010, 12:59:01 PM (12 years ago)
Author:
charles
Message:

(2.0x libT) #3381 "replace calls to usleep() with calls to nanosleep()" -- backported r10916 + r10921 to 2.0x/

Location:
branches/2.0x/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0x/libtransmission/utils.c

    r10838 r10929  
    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"
     
    807808
    808809void
    809 tr_wait_msec( uint64_t delay_milliseconds )
     810tr_wait_msec( long int msec )
    810811{
    811812#ifdef WIN32
    812     Sleep( (DWORD)delay_milliseconds );
     813    Sleep( (DWORD)msec );
    813814#else
    814     usleep( 1000 * delay_milliseconds );
     815    struct timespec ts;
     816    ts.tv_sec = msec / 1000;
     817    ts.tv_nsec = ( msec % 1000 ) * 1000000;
     818    nanosleep( &ts, NULL );
    815819#endif
    816820}
  • branches/2.0x/libtransmission/utils.h

    r10736 r10929  
    266266
    267267/** @brief sleep the specified number of milliseconds */
    268 void tr_wait_msec( uint64_t delay_milliseconds );
     268void tr_wait_msec( long int delay_milliseconds );
    269269
    270270/**
Note: See TracChangeset for help on using the changeset viewer.