Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/task.c
          +++ new/usr/src/uts/common/os/task.c
↓ open down ↓ 365 lines elided ↑ open up ↑
 366  366   * Caller's context
 367  367   *   Caller must not be holding task_hash_lock.  No restrictions on context.
 368  368   */
 369  369  task_t *
 370  370  task_hold_by_id_zone(taskid_t id, zoneid_t zoneid)
 371  371  {
 372  372          task_t *tk;
 373  373  
 374  374          mutex_enter(&task_hash_lock);
 375  375          if ((tk = task_find(id, zoneid)) != NULL)
 376      -                atomic_add_32(&tk->tk_hold_count, 1);
      376 +                atomic_inc_32(&tk->tk_hold_count);
 377  377          mutex_exit(&task_hash_lock);
 378  378  
 379  379          return (tk);
 380  380  }
 381  381  
 382  382  task_t *
 383  383  task_hold_by_id(taskid_t id)
 384  384  {
 385  385          zoneid_t zoneid;
 386  386  
↓ open down ↓ 12 lines elided ↑ open up ↑
 399  399   *
 400  400   * Return values
 401  401   *   None.
 402  402   *
 403  403   * Caller's context
 404  404   *   No restriction on context.
 405  405   */
 406  406  void
 407  407  task_hold(task_t *tk)
 408  408  {
 409      -        atomic_add_32(&tk->tk_hold_count, 1);
      409 +        atomic_inc_32(&tk->tk_hold_count);
 410  410  }
 411  411  
 412  412  /*
 413  413   * void task_rele(task_t *)
 414  414   *
 415  415   * Overview
 416  416   *   task_rele() relinquishes a reference on the given task, which was acquired
 417  417   *   via task_hold() or task_hold_by_id().  If this is the last member or
 418  418   *   observer of the task, dispatch it for commitment via the accounting
 419  419   *   subsystem.
↓ open down ↓ 709 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX