Changeset 5f97ef44 in mainline for uspace/lib


Ignore:
Timestamp:
2018-07-13T14:10:15Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e3787a0
Parents:
9912f49
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-13 14:08:57)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-13 14:10:15)
Message:

Sleep is more natural as part of the fibril API.
(the implementation will move later)

Location:
uspace/lib
Files:
13 edited

Legend:

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

    r9912f49 r5f97ef44  
    515515 *
    516516 */
    517 void async_usleep(suseconds_t timeout)
     517void fibril_usleep(suseconds_t timeout)
    518518{
    519519        awaiter_t awaiter;
     
    538538 * @param sec Number of seconds to sleep
    539539 */
    540 void async_sleep(unsigned int sec)
     540void fibril_sleep(unsigned int sec)
    541541{
    542542        /*
     
    548548                unsigned int period = (sec > 1000) ? 1000 : sec;
    549549
    550                 async_usleep(period * 1000000);
     550                fibril_usleep(period * 1000000);
    551551                sec -= period;
    552552        }
  • uspace/lib/c/generic/irc.c

    r9912f49 r5f97ef44  
    7272
    7373                // XXX This is just a temporary hack
    74                 async_usleep(500 * 1000);
     74                fibril_usleep(500 * 1000);
    7575        }
    7676
  • uspace/lib/c/generic/rcu.c

    r9912f49 r5f97ef44  
    423423         */
    424424        futex_unlock(&rcu.sync_lock.futex);
    425         async_usleep(RCU_SLEEP_MS * 1000);
     425        fibril_usleep(RCU_SLEEP_MS * 1000);
    426426        futex_lock(&rcu.sync_lock.futex);
    427427}
  • uspace/lib/c/include/async.h

    r9912f49 r5f97ef44  
    143143extern errno_t async_wait_timeout(aid_t, errno_t *, suseconds_t);
    144144extern void async_forget(aid_t);
    145 
    146 extern void async_usleep(suseconds_t);
    147 extern void async_sleep(unsigned int);
    148145
    149146extern void async_create_manager(void);
  • uspace/lib/c/include/fibril.h

    r9912f49 r5f97ef44  
    3737
    3838#include <types/common.h>
     39#include <time.h>
    3940
    4041typedef struct fibril fibril_t;
     
    5758extern void fibril_yield(void);
    5859
     60extern void fibril_usleep(suseconds_t);
     61extern void fibril_sleep(unsigned int);
     62
    5963static inline fid_t fibril_create(errno_t (*func)(void *), void *arg)
    6064{
  • uspace/lib/c/test/fibril/timer.c

    r9912f49 r5f97ef44  
    7878
    7979        fibril_timer_set_locked(t, 100 * 1000 * 1000, test_timeout_fn, &cnt);
    80         async_usleep(1000);
     80        fibril_usleep(1000);
    8181        fts = fibril_timer_clear_locked(t);
    8282        PCUT_ASSERT_INT_EQUALS(fts_active, fts);
     
    101101        cnt = 0;
    102102        fibril_timer_set(t, 100 * 1000 * 1000, test_timeout_fn, &cnt);
    103         async_usleep(1000);
     103        fibril_usleep(1000);
    104104        fts = fibril_timer_clear(t);
    105105        PCUT_ASSERT_INT_EQUALS(fts_active, fts);
     
    127127        fibril_mutex_unlock(&lock);
    128128
    129         async_usleep(1000);
     129        fibril_usleep(1000);
    130130
    131131        fibril_mutex_lock(&lock);
  • uspace/lib/cpp/include/__bits/thread/threading.hpp

    r9912f49 r5f97ef44  
    158158            static void sleep(time_unit time)
    159159            {
    160                 hel::async_usleep(time);
     160                hel::fibril_usleep(time);
    161161            }
    162162        };
  • uspace/lib/ieee80211/src/ieee80211.c

    r9912f49 r5f97ef44  
    504504        while (true) {
    505505                ieee80211_dev->ops->scan(ieee80211_dev);
    506                 async_usleep(SCAN_PERIOD_USEC);
     506                fibril_usleep(SCAN_PERIOD_USEC);
    507507        }
    508508
  • uspace/lib/ieee80211/src/ieee80211_impl.c

    r9912f49 r5f97ef44  
    152152
    153153                        /* Wait for probe responses. */
    154                         async_usleep(SCAN_CHANNEL_WAIT_USEC);
     154                        fibril_usleep(SCAN_CHANNEL_WAIT_USEC);
    155155                }
    156156
  • uspace/lib/nic/src/nic_driver.c

    r9912f49 r5f97ef44  
    10831083                                remaining.tv_usec -= wait;
    10841084                        }
    1085                         async_usleep(wait);
     1085                        fibril_usleep(wait);
    10861086
    10871087                        /* Check if the period was not reset */
  • uspace/lib/posix/src/time.c

    r9912f49 r5f97ef44  
    297297                // TODO: interruptible sleep
    298298                if (rqtp->tv_sec != 0) {
    299                         async_sleep(rqtp->tv_sec);
     299                        fibril_sleep(rqtp->tv_sec);
    300300                }
    301301                if (rqtp->tv_nsec != 0) {
    302                         async_usleep(rqtp->tv_nsec / 1000);
     302                        fibril_usleep(rqtp->tv_nsec / 1000);
    303303                }
    304304                return 0;
  • uspace/lib/usbdev/src/devpoll.c

    r9912f49 r5f97ef44  
    190190                // but first we need to fix drivers to actually stop using this,
    191191                // since polling delay should be implemented in HC schedule
    192                 async_usleep(polling->delay);
     192                fibril_usleep(polling->delay);
    193193        }
    194194
  • uspace/lib/usbhost/src/hcd.c

    r9912f49 r5f97ef44  
    125125                 * good enough for emergency mode
    126126                 */
    127                 async_usleep(10000);
     127                fibril_usleep(10000);
    128128        }
    129129        return EOK;
Note: See TracChangeset for help on using the changeset viewer.