<p style="white-space: pre-wrap; word-wrap: break-word;">A few notes:</p><ul><li>with my proposal, there's no need for a osmo_gsm_free_cb_remove(), Simply use:</li><li>"osmo_fsm_free_cb(fi, NULL, NULL);" and you are done.</li></ul><ul><li>Regarding the "deferred until osmo_select_main_ctx()", I'd be fine with it, as long as it doesn't become a hard dependency of osmo_fsm_inst to have a main loop. There could be a "osmo_fsm_defer_free_select_ctx(fi, bool defer);", which when set to true, instead of deallocating it, ->terminated=true is set instead and scheduled to be freed. However, with this option the process may end up accessing the terminated (but still allocated) FSM and we'll not notice it with ASan.</li></ul><ul><li>I still don't think we need this really specific watch API you presented, at least in the libosmocore osmo_fsm API. The API I'm suggesting is pretty similar in lines of code and style, and still provides for far more uses (since the user can program the cb as he wishes).</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">So all in all, I still think the free_cb is the best option here tbh.<br></p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15660">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15660">change 15660</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/15660"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I4d8306488506c60b4c2fc1c4cb3ac04654db9c43 </div>
<div style="display:none"> Gerrit-Change-Number: 15660 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 04 Oct 2019 18:00:00 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>