Changeset 582a0b8 in mainline for uspace/lib/c/generic/thread.c


Ignore:
Timestamp:
2017-05-08T19:20:39Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d2c8533
Parents:
73db198
Message:

Remove unistd.h

  • Rename usleep() and sleep() to thread_usleep() and thread_sleep() and move to thread.[hc].
  • Include stddef.h in order to provide NULL.
  • Move getpagesize() to libposix.
  • Sync uspace/dist/src/c/demos with originals.
File:
1 edited

Legend:

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

    r73db198 r582a0b8  
    196196}
    197197
     198/** Wait unconditionally for specified number of microseconds
     199 *
     200 */
     201int thread_usleep(useconds_t usec)
     202{
     203        (void) __SYSCALL1(SYS_THREAD_USLEEP, usec);
     204        return 0;
     205}
     206
     207/** Wait unconditionally for specified number of seconds
     208 *
     209 */
     210unsigned int thread_sleep(unsigned int sec)
     211{
     212        /*
     213         * Sleep in 1000 second steps to support
     214         * full argument range
     215         */
     216       
     217        while (sec > 0) {
     218                unsigned int period = (sec > 1000) ? 1000 : sec;
     219               
     220                thread_usleep(period * 1000000);
     221                sec -= period;
     222        }
     223       
     224        return 0;
     225}
     226
    198227/** @}
    199228 */
Note: See TracChangeset for help on using the changeset viewer.