2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

[master] prevent exportlib deadlock

3609.	[bug]		Corrected a possible deadlock in applications using
			the export version of the isc_app API. [RT #33967]
This commit is contained in:
Evan Hunt
2013-07-06 18:23:41 -07:00
parent d133989e66
commit eb4458b478
2 changed files with 19 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
3609. [bug] Corrected a possible deadlock in applications using
the export version of the isc_app API. [RT #33967]
3608. [port] win32: added todos.pl script to ensure all text files 3608. [port] win32: added todos.pl script to ensure all text files
the win32 build depends on are converted to DOS the win32 build depends on are converted to DOS
newline format. [RT #22067] newline format. [RT #22067]

View File

@@ -690,6 +690,11 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
* wait until woken up. * wait until woken up.
*/ */
LOCK(&ctx->readylock); LOCK(&ctx->readylock);
if (ctx->want_shutdown) {
/* shutdown() won the race. */
UNLOCK(&ctx->readylock);
break;
}
if (!ctx->want_reload) if (!ctx->want_reload)
WAIT(&ctx->ready, &ctx->readylock); WAIT(&ctx->ready, &ctx->readylock);
UNLOCK(&ctx->readylock); UNLOCK(&ctx->readylock);
@@ -719,7 +724,13 @@ isc__app_ctxrun(isc_appctx_t *ctx0) {
* wait until woken up. * wait until woken up.
*/ */
LOCK(&ctx->readylock); LOCK(&ctx->readylock);
WAIT(&ctx->ready, &ctx->readylock); if (ctx->want_shutdown) {
/* shutdown() won the race. */
UNLOCK(&ctx->readylock);
break;
}
if (!ctx->want_reload)
WAIT(&ctx->ready, &ctx->readylock);
UNLOCK(&ctx->readylock); UNLOCK(&ctx->readylock);
} }
#endif /* HAVE_SIGWAIT */ #endif /* HAVE_SIGWAIT */
@@ -802,7 +813,9 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) {
#endif /* HAVE_LINUXTHREADS */ #endif /* HAVE_LINUXTHREADS */
else { else {
/* External, multiple contexts */ /* External, multiple contexts */
LOCK(&ctx->readylock);
ctx->want_shutdown = ISC_TRUE; ctx->want_shutdown = ISC_TRUE;
UNLOCK(&ctx->readylock);
SIGNAL(&ctx->ready); SIGNAL(&ctx->ready);
} }
#endif /* ISC_PLATFORM_USETHREADS */ #endif /* ISC_PLATFORM_USETHREADS */
@@ -878,7 +891,9 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) {
#endif /* HAVE_LINUXTHREADS */ #endif /* HAVE_LINUXTHREADS */
else { else {
/* External, multiple contexts */ /* External, multiple contexts */
LOCK(&ctx->readylock);
ctx->want_reload = ISC_TRUE; ctx->want_reload = ISC_TRUE;
UNLOCK(&ctx->readylock);
SIGNAL(&ctx->ready); SIGNAL(&ctx->ready);
} }
#endif /* ISC_PLATFORM_USETHREADS */ #endif /* ISC_PLATFORM_USETHREADS */