Changeset 39026d7c in mainline for uspace/lib/c/generic


Ignore:
Timestamp:
2017-11-29T23:41:05Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
908d634
Parents:
f300523
Message:

Replace fibril_usleep() with async_usleep().

Location:
uspace/lib/c/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    rf300523 r39026d7c  
    18681868       
    18691869        amsg_destroy(msg);
     1870}
     1871
     1872/** Delay execution for the specified number of seconds
     1873 *
     1874 * @param sec Number of seconds to sleep
     1875 */
     1876void async_sleep(unsigned int sec)
     1877{
     1878        /*
     1879         * Sleep in 1000 second steps to support
     1880         * full argument range
     1881         */
     1882
     1883        while (sec > 0) {
     1884                unsigned int period = (sec > 1000) ? 1000 : sec;
     1885
     1886                async_usleep(period * 1000000);
     1887                sec -= period;
     1888        }
    18701889}
    18711890
  • uspace/lib/c/generic/fibril_synch.c

    rf300523 r39026d7c  
    629629}
    630630
    631 /** Delay fibril execution for the specified number of microseconds
    632  *
    633  * @param usec Number of microseconds to sleep
    634  */
    635 void fibril_usleep(useconds_t usec)
    636 {
    637         fibril_condvar_t cv;
    638         fibril_mutex_t lock;
    639 
    640         fibril_condvar_initialize(&cv);
    641         fibril_mutex_initialize(&lock);
    642         fibril_mutex_lock(&lock);
    643         fibril_condvar_wait_timeout(&cv, &lock, usec);
    644         fibril_mutex_unlock(&lock);
    645 }
    646 
    647 /** Delay fibril execution for the specified number of seconds
    648  *
    649  * @param sec Number of seconds to sleep
    650  */
    651 void fibril_sleep(unsigned int sec)
    652 {
    653         /*
    654          * Sleep in 1000 second steps to support
    655          * full argument range
    656          */
    657 
    658         while (sec > 0) {
    659                 unsigned int period = (sec > 1000) ? 1000 : sec;
    660 
    661                 fibril_usleep(period * 1000000);
    662                 sec -= period;
    663         }
    664 }
    665 
    666 
    667631/** @}
    668632 */
  • uspace/lib/c/generic/irc.c

    rf300523 r39026d7c  
    3434
    3535#include <assert.h>
     36#include <async.h>
    3637#include <errno.h>
    37 #include <fibril_synch.h>
    3838#include <ipc/irc.h>
    3939#include <ipc/services.h>
     
    7272
    7373                // XXX This is just a temporary hack
    74                 fibril_usleep(500 * 1000);
     74                async_usleep(500 * 1000);
    7575        }
    7676
Note: See TracChangeset for help on using the changeset viewer.