Revision d180e1ba core/src/aos_thread.c

View differences:

core/src/aos_thread.c
55 55
 *
56 56
 * @param[in] t     Deadline until the thread will sleep.
57 57
 */
58
void aosThdSleepUntilS(const aos_timestamp_t* t)
58
void aosThdSleepUntilS(const aos_timestamp_t t)
59 59
{
60
  aosDbgCheck(t != NULL);
61

  
62 60
  aos_timestamp_t uptime;
63 61

  
64 62
  // get the current system uptime
65 63
  aosSysGetUptimeX(&uptime);
66 64

  
67 65
  // while the remaining time is too long, it must be split into multiple sleeps
68
  while ( (*t > uptime) && ((*t - uptime) > AOS_THD_MAX_SLEEP_US) ) {
66
  while ( (t > uptime) && ((t - uptime) > AOS_THD_MAX_SLEEP_US) ) {
69 67
    chThdSleepS(chTimeUS2I(AOS_THD_MAX_SLEEP_US));
70 68
    aosSysGetUptimeX(&uptime);
71 69
  }
72 70

  
73 71
  // sleep the remaining time
74
  if (*t > uptime) {
75
    sysinterval_t rest = chTimeUS2I(*t - uptime);
72
  if (t > uptime) {
73
    sysinterval_t rest = chTimeUS2I(t - uptime);
76 74
    if (rest > TIME_IMMEDIATE) {
77 75
      chThdSleepS(rest);
78 76
    }

Also available in: Unified diff