> Konstantin Ananyev, Feb 06, 2023 at 21:34: > > Yes, app knows what resources it wants to free. > > But it has no way to know *when* it is safe to free them. > > Just a bit more explanation: > > App invokes your function which resets global value of CB. > > How would it know that after return from this function none > > other thread still not executing this CB right now? > > And how determine when this thread will finish with executing CB function? > > That's why it might be easier simply not allow to reset it at all.... > > Ok I see. But what should we do to prevent this? Simply ignore the > request and log a warning?
That's seems like simplest choice to me... Or if you still prefer to allow it - put a special comment that it is user responsibility to handle such possible race-condition (inside his CB function or so).