From 55189492eca07690e1917b85f6d72dcf450cf5e2 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Thu, 9 Jan 2025 14:37:39 +0100 Subject: [PATCH] parcall: command for clear parallel call groups (#63) --- modules/parcall/parcall.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/parcall/parcall.c b/modules/parcall/parcall.c index 3a04da9..e7fc88b 100644 --- a/modules/parcall/parcall.c +++ b/modules/parcall/parcall.c @@ -333,6 +333,25 @@ static int cmd_rmpar(struct re_printf *pf, void *arg) } +/** + * Clear list of parallel call groups + * + * @param pf Print handler + * @param arg not used + * + * @return 0 if success, otherwise errorcode + */ +static int cmd_clrpar(struct re_printf *pf, void *arg) +{ + (void)arg; + + hash_flush(d.pargroups); + (void)re_hprintf(pf, "parcall: cleared parallel call groups\n"); + + return 0; +} + + /** * Add a parallel call target to a group * @@ -515,6 +534,7 @@ static int cmd_pardebug(struct re_printf *pf, void *arg) static const struct cmd cmdv[] = { {"mkpar", 0,CMD_PRM, "Create parallel call group", cmd_mkpar }, {"rmpar", 0,CMD_PRM, "Remove parallel call group", cmd_rmpar }, + {"clrpar", 0, 0, "Clear parallel call groups", cmd_clrpar }, {"paradd", 0,CMD_PRM, "Add a call target to a group", cmd_paradd }, {"parcall", 0,CMD_PRM, "Initiate parallel call to given group", cmd_parcall },