Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
1b32bc7d
Commit
1b32bc7d
authored
Sep 01, 2000
by
Brian Wellington
Browse files
417. [func] Add isc_app_block() and isc_app_unblock(), which
allow an application to handle signals while blocking.
parent
da41917c
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
1b32bc7d
417. [func] Add isc_app_block() and isc_app_unblock(), which
allow an application to handle signals while
blocking.
416. [bug] Slave zones with no master file tried to use a
NULL pointer for a journal file name when they
received an IXFR. [RT #273]
...
...
lib/isc/unix/app.c
View file @
1b32bc7d
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: app.c,v 1.2
8
2000/0
8/30 23:47:16
bwelling Exp $ */
/* $Id: app.c,v 1.2
9
2000/0
9/01 21:31:51
bwelling Exp $ */
#include <config.h>
...
...
@@ -58,6 +58,11 @@ static isc_boolean_t want_shutdown = ISC_FALSE;
*/
static
isc_boolean_t
want_reload
=
ISC_FALSE
;
static
isc_boolean_t
blocked
=
ISC_FALSE
;
#ifdef ISC_PLATFORM_USETHREADS
static
pthread_t
blockedthread
;
#endif
#ifdef HAVE_LINUXTHREADS
/*
* Linux has sigwait(), but it appears to prevent signal handlers from
...
...
@@ -521,3 +526,43 @@ isc_app_finish(void) {
DESTROYLOCK
(
&
lock
);
}
void
isc_app_block
(
void
)
{
#ifdef ISC_PLATFORM_USETHREADS
sigset_t
sset
;
#endif
REQUIRE
(
running
);
REQUIRE
(
!
blocked
);
blocked
=
ISC_TRUE
;
#ifdef ISC_PLATFORM_USETHREADS
blockedthread
=
pthread_self
();
RUNTIME_CHECK
(
sigemptyset
(
&
sset
)
==
0
&&
sigaddset
(
&
sset
,
SIGINT
)
==
0
&&
sigaddset
(
&
sset
,
SIGTERM
)
==
0
);
RUNTIME_CHECK
(
pthread_sigmask
(
SIG_UNBLOCK
,
&
sset
,
NULL
)
==
0
);
#endif
}
void
isc_app_unblock
(
void
)
{
#ifdef ISC_PLATFORM_USETHREADS
sigset_t
sset
;
#endif
REQUIRE
(
running
);
REQUIRE
(
blocked
);
blocked
=
ISC_FALSE
;
#ifdef ISC_PLATFORM_USETHREADS
REQUIRE
(
blockedthread
==
pthread_self
());
RUNTIME_CHECK
(
sigemptyset
(
&
sset
)
==
0
&&
sigaddset
(
&
sset
,
SIGINT
)
==
0
&&
sigaddset
(
&
sset
,
SIGTERM
)
==
0
);
RUNTIME_CHECK
(
pthread_sigmask
(
SIG_BLOCK
,
&
sset
,
NULL
)
==
0
);
#endif
}
lib/isc/unix/include/isc/app.h
View file @
1b32bc7d
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: app.h,v 1.
8
2000/0
8
/01
0
1:31:
34 tale
Exp $ */
/* $Id: app.h,v 1.
9
2000/0
9
/01
2
1:31:
53 bwelling
Exp $ */
#ifndef ISC_APP_H
#define ISC_APP_H 1
...
...
@@ -176,6 +176,37 @@ isc_app_finish(void);
* Any resources allocated by isc_app_start() have been released.
*/
void
isc_app_block
(
void
);
/*
* Indicate that a blocking operation will be performed.
*
* Notes:
* If a blocking operation is in process, a call to isc_app_shutdown()
* or an external signal will abort the program, rather than allowing
* clean shutdown. This is primarily useful for reading user input.
*
* Requires:
* isc_app_start() has been called.
* No other blocking operations are in progress.
*/
void
isc_app_unblock
(
void
);
/*
* Indicate that a blocking operation is complete.
*
* Notes:
* When a blocking operation has completed, return the program to a
* state where a call to isc_app_shutdown() or an external signal will
* shutdown normally.
*
* Requires:
* isc_app_start() has been called.
* isc_app_block() has been called by the same thread.
*/
ISC_LANG_ENDDECLS
#endif
/* ISC_APP_H */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment