Guest User

Untitled

a guest
Oct 15th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. 03070 static void recalc_holdtime(struct queue_ent *qe, int newholdtime)
  2. 03071 {
  3. 03072    int oldvalue;
  4. 03073
  5. 03074    /* Calculate holdtime using an exponential average */
  6. 03075    /* Thanks to SRT for this contribution */
  7. 03076    /* 2^2 (4) is the filter coefficient; a higher exponent would give old entries more weight */
  8. 03077
  9. 03078    ao2_lock(qe->parent);
  10. 03079    oldvalue = qe->parent->holdtime;
  11. 03080    qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2;
  12. 03081    ao2_unlock(qe->parent);
  13. 03082 }
Add Comment
Please, Sign In to add comment