mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Make lib/isc/app.c opaque and thread-safe
This work cleans up the API which includes couple of things: 1. Make the isc_appctx_t type fully opaque 2. Protect all access to the isc_app_t members via stdatomics 3. sigwait() is part of POSIX.1, remove dead non-sigwait code 4. Remove unused code: isc_appctx_set{taskmgr,sockmgr,timermgr}
This commit is contained in:
@@ -103,14 +103,7 @@ typedef isc_event_t isc_appevent_t;
|
||||
* of the isc_app_ routines to work. app implementations must maintain
|
||||
* all app context invariants.
|
||||
*/
|
||||
struct isc_appctx {
|
||||
unsigned int impmagic;
|
||||
unsigned int magic;
|
||||
};
|
||||
|
||||
#define ISCAPI_APPCTX_MAGIC ISC_MAGIC('A','a','p','c')
|
||||
#define ISCAPI_APPCTX_VALID(c) ((c) != NULL && \
|
||||
(c)->magic == ISCAPI_APPCTX_MAGIC)
|
||||
struct isc_appctx;
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
@@ -184,10 +177,10 @@ isc_app_isrunning(void);
|
||||
*\li false App is not running.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_app_ctxshutdown(isc_appctx_t *ctx);
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_app_shutdown(void);
|
||||
/*!<
|
||||
* \brief Request application shutdown.
|
||||
@@ -205,13 +198,13 @@ isc_app_shutdown(void);
|
||||
*\li ISC_R_UNEXPECTED
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_app_ctxsuspend(isc_appctx_t *ctx);
|
||||
/*!<
|
||||
* \brief This has the same behavior as isc_app_ctxsuspend().
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
isc_app_reload(void);
|
||||
/*!<
|
||||
* \brief Request application reload.
|
||||
@@ -295,44 +288,6 @@ isc_appctx_destroy(isc_appctx_t **ctxp);
|
||||
*\li *ctxp == NULL.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr);
|
||||
/*!<
|
||||
* \brief Associate a task manager with an application context.
|
||||
*
|
||||
* This must be done before running tasks within the application context.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'ctx' is a valid application context.
|
||||
*\li 'taskmgr' is a valid task manager.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr);
|
||||
/*!<
|
||||
* \brief Associate a socket manager with an application context.
|
||||
*
|
||||
* This must be done before handling socket events within the application
|
||||
* context.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'ctx' is a valid application context.
|
||||
*\li 'socketmgr' is a valid socket manager.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr);
|
||||
/*!<
|
||||
* \brief Associate a socket timer with an application context.
|
||||
*
|
||||
* This must be done before handling timer events within the application
|
||||
* context.
|
||||
*
|
||||
* Requires:
|
||||
*\li 'ctx' is a valid application context.
|
||||
*\li 'timermgr' is a valid timer manager.
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_APP_H */
|
||||
|
@@ -805,8 +805,7 @@ isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region,
|
||||
/*@}*/
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx,
|
||||
isc_socketmgr_t **managerp);
|
||||
isc_socketmgr_createinctx(isc_mem_t *mctx, isc_socketmgr_t **managerp);
|
||||
|
||||
isc_result_t
|
||||
isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp);
|
||||
|
@@ -630,7 +630,7 @@ isc_task_privilege(isc_task_t *task);
|
||||
*****/
|
||||
|
||||
isc_result_t
|
||||
isc_taskmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx,
|
||||
isc_taskmgr_createinctx(isc_mem_t *mctx,
|
||||
unsigned int workers, unsigned int default_quantum,
|
||||
isc_taskmgr_t **managerp);
|
||||
isc_result_t
|
||||
|
@@ -316,8 +316,7 @@ isc_timer_gettype(isc_timer_t *timer);
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_timermgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx,
|
||||
isc_timermgr_t **managerp);
|
||||
isc_timermgr_createinctx(isc_mem_t *mctx, isc_timermgr_t **managerp);
|
||||
|
||||
isc_result_t
|
||||
isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp);
|
||||
|
Reference in New Issue
Block a user