Add ng_rmnode_flags() so the caller can pass NG_QUEUE and have the node

destroyed asynchronously due to locking or other constraints.

Reviewed by:	julian
This commit is contained in:
Andrew Thompson 2008-09-22 19:28:18 +00:00
parent a1215e37a4
commit 89ac5af9c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183277
2 changed files with 9 additions and 2 deletions

View File

@ -1130,6 +1130,7 @@ item_p ng_package_msg(struct ng_mesg *msg, int flags);
item_p ng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg);
void ng_replace_retaddr(node_p here, item_p item, ng_ID_t retaddr);
int ng_rmhook_self(hook_p hook); /* if a node wants to kill a hook */
int ng_rmnode_flags(node_p here, int flags);
int ng_rmnode_self(node_p here); /* if a node wants to suicide */
int ng_rmtype(struct ng_type *tp);
int ng_snd_item(item_p item, int queue);

View File

@ -1507,7 +1507,7 @@ ng_mkpeer(node_p node, const char *name, const char *name2, char *type)
/* Shut this node down as soon as everyone is clear of it */
/* Should add arg "immediately" to jump the queue */
int
ng_rmnode_self(node_p node)
ng_rmnode_flags(node_p node, int flags)
{
int error;
@ -1517,10 +1517,16 @@ ng_rmnode_self(node_p node)
if (node->nd_flags & NGF_CLOSING)
return (0);
error = ng_send_fn(node, NULL, &ng_rmnode, NULL, 0);
error = ng_send_fn1(node, NULL, &ng_rmnode, NULL, 0, flags);
return (error);
}
int
ng_rmnode_self(node_p node)
{
return (ng_rmnode_flags(node, NG_NOFLAGS));
}
static void
ng_rmhook_part2(node_p node, hook_p hook, void *arg1, int arg2)
{