Commit c822f236 authored by Karl Heyes's avatar Karl Heyes
Browse files

minor cleanups, and only have one thread responding to TERM

svn path=/trunk/avl/; revision=5787
parent 80dafcfd
......@@ -22,7 +22,7 @@
*
*/
/* $Id: avl.c,v 1.10 2003/12/04 16:27:30 oddsock Exp $ */
/* $Id: avl.c,v 1.11 2004/01/27 02:16:25 karl Exp $ */
/*
* This is a fairly straightfoward translation of a prototype
......@@ -89,7 +89,8 @@ avl_tree_free_helper (avl_node * node, avl_free_key_fun_type free_key_fun)
if (node->left) {
avl_tree_free_helper (node->left, free_key_fun);
}
free_key_fun (node->key);
if (free_key_fun)
free_key_fun (node->key);
if (node->right) {
avl_tree_free_helper (node->right, free_key_fun);
}
......@@ -446,7 +447,8 @@ int avl_delete(avl_tree *tree, void *key, avl_free_key_fun_type free_key_fun)
p = x->parent;
/* return the key and node to storage */
free_key_fun (x->key);
if (free_key_fun)
free_key_fun (x->key);
thread_rwlock_destroy (&x->rwlock);
free (x);
......
......@@ -222,7 +222,6 @@ static void _block_signals(void)
/* These ones we want */
sigdelset(&ss, SIGKILL);
sigdelset(&ss, SIGSTOP);
sigdelset(&ss, SIGTERM);
sigdelset(&ss, SIGSEGV);
sigdelset(&ss, SIGBUS);
if (pthread_sigmask(SIG_BLOCK, &ss, NULL) != 0) {
......@@ -250,6 +249,7 @@ static void _catch_signals(void)
sigaddset(&ss, SIGCHLD);
sigaddset(&ss, SIGINT);
sigaddset(&ss, SIGPIPE);
sigaddset(&ss, SIGTERM);
if (pthread_sigmask(SIG_UNBLOCK, &ss, NULL) != 0) {
#ifdef THREAD_DEBUG
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment