> > > 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).
> 
> The issue is that a warning can be easily overlooked and the application
> may assume that they can free up resources whereas the callback was
> never reset and may still access them.
 
Yes, could happen, in principle. 
 
> I wonder if this could be enforced with RTE_BUILD_BUG_ON somehow.
 
I don't think it is possible, as the value can change at runtime.

> Or at   least by checking that the cb value is not NULL with RTE_ASSERT?

assert() would work, but general rule of thumb - don't panic() in library
functions, but return an error. 
After another thought - might be allowing user to call it at run-time 
and just documenting it properly is enough.
After all there are few ways to overcome the problem in user CB function 
itself. 
Konstantin 

Reply via email to