Jabberd14-1.6.0/jabberd/heartbeat.c/heartbeat_birth

Last-modified: 2007-03-18 (日) 00:05:30

このページを編集する際は,編集に関する方針に従ってください.

概要

/**
 * register a function to receive heartbeats
 */
  • ハートビートを受け取る関数を登録するんだよなぁ。やっぱりheartbeat == signalなのか?

引数

実装

void register_beat(int freq, beathandler f, void *arg) {
    beat newb;
    if(freq <= 0 || f == NULL || heartbeat__ring == NULL) return; /* uhh, probbably don't want to allow negative heartbeats, since the counter will count infinitly to a core */
    /* setup the new beat */
    newb = _new_beat();
    newb->f = f;
    newb->arg = arg;
    newb->freq = freq;
    newb->last = 0;
  • 常に先頭に追加。双方向だからちょっと面倒。
    /* insert #into global ring */
    newb->next = heartbeat__ring->next;
    heartbeat__ring->next = newb;
    newb->prev = heartbeat__ring;
    newb->next->prev = newb;
}

実装の説明を書いてください

呼出元

#related: relatedプラグインは廃止されました。