参照元

説明

引数

返り値

参考

実装

/**
 * hrtimer_try_to_cancel - try to deactivate a timer
 * @timer:      hrtimer to stop
 *
 * Returns:
 *  0 when the timer was not active
 *  1 when the timer was active
 * -1 when the timer is currently excuting the callback function and
 *    cannot be stopped
 */
int hrtimer_try_to_cancel(struct hrtimer *timer)
{
        struct hrtimer_clock_base *base;
        unsigned long flags;
        int ret = -1;
        /*
         * Check lockless first. If the timer is not active (neither
         * enqueued nor running the callback, nothing to do here.  The
         * base lock does not serialize against a concurrent enqueue,
         * so we can avoid taking it.
         */
        if (!hrtimer_active(timer))
                return 0;
        base = lock_hrtimer_base(timer, &flags);
        if (!hrtimer_callback_running(timer))
                ret = remove_hrtimer(timer, base, false);
        unlock_hrtimer_base(timer, &flags);
        return ret;

}
EXPORT_SYMBOL_GPL(hrtimer_try_to_cancel);

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-06-27 (月) 12:54:10