/*1* Copyright (c) 2009-2012 Niels Provos and Nick Mathewson2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer.8* 2. Redistributions in binary form must reproduce the above copyright9* notice, this list of conditions and the following disclaimer in the10* documentation and/or other materials provided with the distribution.11* 3. The name of the author may not be used to endorse or promote products12* derived from this software without specific prior written permission.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR15* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES16* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.17* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,18* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT19* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,20* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY21* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF23* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.24*/25#ifndef DEFER_INTERNAL_H_INCLUDED_26#define DEFER_INTERNAL_H_INCLUDED_2728#ifdef __cplusplus29extern "C" {30#endif3132#include "event2/event-config.h"33#include "evconfig-private.h"3435#include <sys/queue.h>3637struct event_callback;38typedef void (*deferred_cb_fn)(struct event_callback *, void *);3940/**41Initialize an empty, non-pending event_callback.4243@param deferred The struct event_callback structure to initialize.44@param priority The priority that the callback should run at.45@param cb The function to run when the struct event_callback executes.46@param arg The function's second argument.47*/48EVENT2_EXPORT_SYMBOL49void event_deferred_cb_init_(struct event_callback *, ev_uint8_t, deferred_cb_fn, void *);50/**51Change the priority of a non-pending event_callback.52*/53void event_deferred_cb_set_priority_(struct event_callback *, ev_uint8_t);54/**55Cancel a struct event_callback if it is currently scheduled in an event_base.56*/57EVENT2_EXPORT_SYMBOL58void event_deferred_cb_cancel_(struct event_base *, struct event_callback *);59/**60Activate a struct event_callback if it is not currently scheduled in an event_base.6162Return true if it was not previously scheduled.63*/64EVENT2_EXPORT_SYMBOL65int event_deferred_cb_schedule_(struct event_base *, struct event_callback *);6667#ifdef __cplusplus68}69#endif7071#endif /* EVENT_INTERNAL_H_INCLUDED_ */72737475