open-switch / opx-cps

https://openswitch.net
6 stars 15 forks source link

Not able to remove registration added with cps_api_event_thread_reg #91

Open james-jra opened 6 years ago

james-jra commented 6 years ago

Feature request

The Event Thread Utilities API allows an application to register a callback to be executed on a CPS event using the cps_api_event_thread_reg function.

However, it appears that there is no way to remove that registration without terminating the entire event thread with cps_api_event_thread_shutdown. Therefore any registered callbacks must exist for the entire lifetime of the event thread. In most cases, this is equivalent to the lifetime of the application.

Is this analysis correct?

If so, is it possible to extend this API to allow an application to remove or un-register a callback against a CPS event?

This would allow an application to dynamically add or remove event handlers at will during the lifetime of the application.

atanu-mandal commented 6 years ago

Hi James, Currently there is no option to un-register a callback function from the event in dynamic fashion. Your analysis is correct. We have an internal enhancement request as well to provide the facility in future release.

I will update you when the feature is available.

Thanks, -Atanu