[PATCH] libosmocore[master]: fsm: do not terminate child FSMs to early

dexter gerrit-no-reply at lists.osmocom.org
Thu Feb 8 12:22:15 UTC 2018

Review at  https://gerrit.osmocom.org/6318

fsm: do not terminate child FSMs to early

The function _osmo_fsm_inst_term() terminates all child FSMs befor
it calls fi->fsm_cleanup(). This prevnts the cleanup callback to
perform last actions on the child FSMs (e.g.

move the function call to  _osmo_fsm_inst_term_children() below the
call to fi->fsm->cleanup().

Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
M src/fsm.c
1 file changed, 4 insertions(+), 3 deletions(-)

  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/18/6318/1

diff --git a/src/fsm.c b/src/fsm.c
index d8751c9..dd3538f 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -509,9 +509,6 @@
 	LOGPFSMSRC(fi, file, line, "Terminating (cause = %s)\n",
-	_osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL,
-				     file, line);
 	/* delete ourselves from the parent */
 	parent = fi->proc.parent;
 	if (parent) {
@@ -524,6 +521,10 @@
 	if (fi->fsm->cleanup)
 		fi->fsm->cleanup(fi, cause);
+	/* terminate all children */
+	_osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL,
+				     file, line);
 	LOGPFSMSRC(fi, file, line, "Freeing instance\n");
 	/* Fetch parent again in case it has changed. */
 	parent = fi->proc.parent;

To view, visit https://gerrit.osmocom.org/6318
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie89d435417306c6bf897274eabc3ed0a46485c26
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>

More information about the gerrit-log mailing list