2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Synchronize the isc_trampoline API with changes needed in v9_16

This commit synchronizes the isc_trampoline API to match the changes
needed to fix Windows service in v9_16.
This commit is contained in:
Ondřej Surý 2021-08-31 17:25:07 +00:00 committed by Michał Kępień
parent 87a289de00
commit 45726fc01f
2 changed files with 24 additions and 8 deletions

View File

@ -143,8 +143,8 @@ done:
return (trampoline);
}
static void
trampoline_put(isc__trampoline_t *trampoline) {
void
isc__trampoline_detach(isc__trampoline_t *trampoline) {
LOCK(&isc__trampoline_lock);
REQUIRE(trampoline->tid > 0 &&
(size_t)trampoline->tid < isc__trampoline_max);
@ -163,11 +163,8 @@ trampoline_put(isc__trampoline_t *trampoline) {
return;
}
isc_threadresult_t
isc__trampoline_run(isc_threadarg_t arg) {
isc__trampoline_t *trampoline = (isc__trampoline_t *)arg;
isc_threadresult_t result;
void
isc__trampoline_attach(isc__trampoline_t *trampoline) {
REQUIRE(trampoline->tid > 0 &&
(size_t)trampoline->tid < isc__trampoline_max);
REQUIRE(trampoline->self == ISC__TRAMPOLINE_UNUSED);
@ -175,11 +172,19 @@ isc__trampoline_run(isc_threadarg_t arg) {
/* Initialize the trampoline */
isc_tid_v = trampoline->tid;
trampoline->self = isc_thread_self();
}
isc_threadresult_t
isc__trampoline_run(isc_threadarg_t arg) {
isc__trampoline_t *trampoline = (isc__trampoline_t *)arg;
isc_threadresult_t result;
isc__trampoline_attach(trampoline);
/* Run the main function */
result = (trampoline->start)(trampoline->arg);
trampoline_put(trampoline);
isc__trampoline_detach(trampoline);
return (result);
}

View File

@ -63,6 +63,17 @@ isc__trampoline_get(isc_threadfunc_t start_routine, isc_threadarg_t arg);
*\li 'start_routine' is a valid non-NULL thread start_routine
*/
void
isc__trampoline_attach(isc__trampoline_t *trampoline);
void
isc__trampoline_detach(isc__trampoline_t *trampoline);
/*%<
* Attach/detach the trampoline to/from the current thread.
*
* Requires:
* \li 'trampoline' is a valid isc__trampoline_t
*/
isc_threadresult_t
isc__trampoline_run(isc_threadarg_t arg);
/*%<