Changeset dd655970 in mainline for uspace/libc/generic


Ignore:
Timestamp:
2007-04-06T14:01:46Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69e9dd2
Parents:
3ce7f082
Message:

new user space testing framework (unfinished)

Location:
uspace/libc/generic
Files:
2 edited

Legend:

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

    r3ce7f082 rdd655970  
    161161}
    162162
     163/** Detach thread.
     164 *
     165 * Currently not implemented.
     166 *
     167 * @param thread TID.
     168 */
     169void thread_detach(int thread)
     170{
     171}
     172
     173/** Join thread.
     174 *
     175 * Currently not implemented.
     176 *
     177 * @param thread TID.
     178 *
     179 * @return Thread exit status.
     180 */
     181int thread_join(int thread)
     182{
     183}
     184
     185/** Get current thread ID.
     186 *
     187 * @return Current thread ID.
     188 */
     189int thread_get_id(void)
     190{
     191        return __SYSCALL0(SYS_THREAD_GET_ID);
     192}
     193
    163194/** @}
    164195 */
  • uspace/libc/generic/time.c

    r3ce7f082 rdd655970  
    109109}
    110110
    111 /** Wait unconditionally for specified microseconds */
     111/** Wait unconditionally for specified number of microseconds */
    112112void usleep(unsigned long usec)
    113113{
    114114        atomic_t futex = FUTEX_INITIALIZER;
    115115
    116         futex_initialize(&futex,0);
     116        futex_initialize(&futex, 0);
    117117        futex_down_timeout(&futex, usec, 0);
     118}
     119
     120/** Wait unconditionally for specified number of seconds */
     121unsigned int sleep(unsigned int seconds)
     122{
     123        atomic_t futex = FUTEX_INITIALIZER;
     124
     125        futex_initialize(&futex, 0);
     126       
     127        /* Sleep in 1000 second steps to support
     128           full argument range */
     129        while (seconds > 0) {
     130                unsigned int period = (seconds > 1000) ? 1000 : seconds;
     131       
     132                futex_down_timeout(&futex, period * 1000000, 0);
     133                seconds -= period;
     134        }
    118135}
    119136
Note: See TracChangeset for help on using the changeset viewer.