From 5c5bd6900cfa6da590c41e1dfd7477447fbdd702 Mon Sep 17 00:00:00 2001 From: Corey Minyard Date: Fri, 6 Sep 2024 12:50:20 -0500 Subject: [PATCH] c++:osh: Add a comment about the logger on Os_Funcs The logger must be dynamically allocated. Signed-off-by: Corey Minyard --- c++/include/gensio/gensioosh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/c++/include/gensio/gensioosh b/c++/include/gensio/gensioosh index 23a105ce..84dc1d95 100644 --- a/c++/include/gensio/gensioosh +++ b/c++/include/gensio/gensioosh @@ -68,10 +68,17 @@ namespace gensios { // This is a smart pointer like object. class GENSIOOSHCPP_DLL_PUBLIC Os_Funcs { public: - // Allocate an os function handlers for the platform. - // See gensio_alloc_os_funcs.3 for details. Note that if you - // pass in -1 for wait_sig, it will pick the default wait signal, + // Allocate an os function handlers for the platform. See + // gensio_alloc_os_funcs.3 for details. Note that if you pass + // in -1 for wait_sig, it will pick the default wait signal, // SIGUSR1 on Unix type systems. + // + // The logger you pass in here *must* be dynamically + // allocated, the Os_Funcs takes over the task of freeing it + // when done. This is a little strange, but that way if the + // Os_Funcs here gets destroyed and another one outlives it, a + // locally allocated logger won't be deleted while still in + // use. Os_Funcs(int wait_sig, Os_Funcs_Log_Handler *logger = NULL); Os_Funcs(int wait_sig, Os_Funcs_Log_Handler *logger,