Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/clock_highres.c
          +++ new/usr/src/uts/common/os/clock_highres.c
↓ open down ↓ 85 lines elided ↑ open up ↑
  86   86  
  87   87  static void
  88   88  clock_highres_fire(void *arg)
  89   89  {
  90   90          itimer_t *it = (itimer_t *)arg;
  91   91          hrtime_t *addr = &it->it_hrtime;
  92   92          hrtime_t old = *addr, new = gethrtime();
  93   93  
  94   94          do {
  95   95                  old = *addr;
  96      -        } while (cas64((uint64_t *)addr, old, new) != old);
       96 +        } while (atomic_cas_64((uint64_t *)addr, old, new) != old);
  97   97  
  98   98          timer_fire(it);
  99   99  }
 100  100  
 101  101  static int
 102  102  clock_highres_timer_settime(itimer_t *it, int flags,
 103  103          const struct itimerspec *when)
 104  104  {
 105  105          cyclic_id_t cyc, *cycp = it->it_arg;
 106  106          proc_t *p = curproc;
↓ open down ↓ 121 lines elided ↑ open up ↑
 228  228          /*
 229  229           * CLOCK_HIGHRES doesn't update it_itime.
 230  230           */
 231  231          hrtime_t start = ts2hrt(&it->it_itime.it_value);
 232  232          hrtime_t interval = ts2hrt(&it->it_itime.it_interval);
 233  233          hrtime_t diff, now = gethrtime();
 234  234          hrtime_t *addr = &it->it_hrtime;
 235  235          hrtime_t last;
 236  236  
 237  237          /*
 238      -         * We're using cas64() here only to assure that we slurp the entire
 239      -         * timestamp atomically.
      238 +         * We're using atomic_cas_64() here only to assure that we slurp the
      239 +         * entire timestamp atomically.
 240  240           */
 241      -        last = cas64((uint64_t *)addr, 0, 0);
      241 +        last = atomic_cas_64((uint64_t *)addr, 0, 0);
 242  242  
 243  243          *when = it->it_itime;
 244  244  
 245  245          if (!timerspecisset(&when->it_value))
 246  246                  return (0);
 247  247  
 248  248          if (start > now) {
 249  249                  /*
 250  250                   * We haven't gone off yet...
 251  251                   */
↓ open down ↓ 122 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX