pnoltes commented on issue #574: URL: https://github.com/apache/celix/issues/574#issuecomment-1595812615
Nice read and good to see that there is already a initiative and commitment to use the cleanup attribute from a very important and relevant source. Reading the article I think we can use all 3 setups: cleanup for pointer variables, cleanup for "classes" and lock guards. I think in the case of lock guards, we can use a simpler approach (because we only need to support the celix mutex and rwlock). Reading this I think he "class" approach fits our _create / _destroy pairs. But maybe we can also introduce a "retain guard", so that we a shared_ptr like RAII ref counting support, e.g. ``` void foo(foo_t* foo, celix_event_t* event) { celix_event_retain_guard(localEvent) = event ; // calls celix_event_retain ...... } // calls celix_event_release ``` But lets start with mimicking what is already used for the Linux kernel. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org