renamed existing qse_httpd_inserttimerevent() and qse_httpd_removetimerevent() to qse_httpd_insert_timer_event() and qse_httpd_remove_timer_event().

the renamed functions should be used internally only.
added new qse_httpd_inserttimerevent() and qse_httpd_removetimerevent() that can be used by external callers.
added qse_httpd_timer_event_t and other required definitions for the new functions
This commit is contained in:
2014-11-01 15:27:56 +00:00
parent baecb98181
commit 569b30039b
7 changed files with 180 additions and 45 deletions

View File

@ -30,14 +30,14 @@ typedef qse_size_t qse_tmr_index_t;
typedef void (*qse_tmr_handler_t) (
qse_tmr_t* tmr,
const qse_ntime_t* now,
void* ctx
qse_tmr_event_t* evt
);
typedef void (*qse_tmr_updater_t) (
qse_tmr_t* tmr,
qse_tmr_index_t old_index,
qse_tmr_index_t new_index,
void* ctx
qse_tmr_event_t* evt
);
struct qse_tmr_t
@ -50,8 +50,11 @@ struct qse_tmr_t
struct qse_tmr_event_t
{
void* ctx; /* primary context pointer */
void* ctx2; /* secondary context pointer */
void* ctx3; /* tertiary context pointer */
qse_ntime_t when;
void* ctx;
qse_tmr_handler_t handler;
qse_tmr_updater_t updater;
};
@ -130,6 +133,15 @@ QSE_EXPORT int qse_tmr_gettmout (
qse_ntime_t* tmout
);
/**
* The qse_tmr_getevent() function returns the
* pointer to the registered event at the given index.
*/
QSE_EXPORT qse_tmr_event_t* qse_tmr_getevent (
qse_tmr_t* tmr,
qse_tmr_index_t index
);
#ifdef __cplusplus
}
#endif

View File

@ -528,6 +528,33 @@ struct qse_httpd_rcb_t
qse_httpd_logact_t logact;
};
/* -------------------------------------------------------------------------- */
typedef qse_tmr_index_t qse_httpd_timer_index_t;
typedef void (*qse_httpd_timer_handler_t) (
qse_httpd_t* httpd,
const qse_ntime_t* now,
void* ctx
);
typedef void (*qse_httpd_timer_updater_t) (
qse_httpd_t* httpd,
qse_httpd_timer_index_t old_index,
qse_httpd_timer_index_t new_index,
void* ctx
);
typedef struct qse_httpd_timer_event_t qse_httpd_timer_event_t;
struct qse_httpd_timer_event_t
{
void* ctx; /* primary context pointer */
qse_ntime_t when;
qse_httpd_timer_handler_t handler;
qse_httpd_timer_updater_t updater;
};
/* -------------------------------------------------------------------------- */
typedef struct qse_httpd_task_t qse_httpd_task_t;
@ -1363,16 +1390,18 @@ QSE_EXPORT qse_httpd_mod_t* qse_httpd_findmod (
/* -------------------------------------------- */
QSE_EXPORT int qse_httpd_inserttimerevent (
qse_httpd_t* httpd,
const qse_tmr_event_t* event,
qse_tmr_index_t* index
qse_httpd_t* httpd,
const qse_httpd_timer_event_t* event,
qse_httpd_timer_index_t* index
);
QSE_EXPORT void qse_httpd_removetimerevent (
qse_httpd_t* httpd,
qse_tmr_index_t index
qse_httpd_t* httpd,
qse_httpd_timer_index_t index
);
#ifdef __cplusplus
}
#endif