[ 
https://issues.apache.org/jira/browse/LOGCXX-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17466195#comment-17466195
 ] 

Robert Middleton edited comment on LOGCXX-532 at 12/28/21, 8:06 PM:
--------------------------------------------------------------------

Yeah, that should work - that's effectively what this issue would do.

If you're going to look into this, I would propose that you do the following:
1. Rename APRInitializer to something like Log4cxxInitializer
2. Base your changes off of the 
[next_stable|https://github.com/apache/logging-log4cxx/tree/next_stable] 
branch, as that branch contains many API-breaking changes, and should be 
ABI-stable. 

The next_stable branch also serves as the staging point for eventually removing 
the dependency on APR, as most of what APR is used for is better handled by 
boost/later C++ standards.  This is also why I propose renaming it to 
Log4cxxInitializer, since it's more generic and specific to the library.


was (Author: rmiddleton):
Yeah, that should work - that's effectively what this issue would do.

If you're going to look into this, I would propose that you do the following:
1. Rename APRInitializer to something like Log4cxxInitializer
2. Base your changes off of the 
[next_stable|https://github.com/apache/logging-log4cxx/tree/next_stable] 
branch, as that branch contains many API-breaking changes, and should be 
ABI-stable. 

The next_stable branch also serves as the staging point for eventually removing 
the dependency on APR, as most of what APR is used for is better handled by 
boost/later C++ standards.

> Static objects and deleting
> ---------------------------
>
>                 Key: LOGCXX-532
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-532
>             Project: Log4cxx
>          Issue Type: Improvement
>            Reporter: Robert Middleton
>            Assignee: Robert Middleton
>            Priority: Minor
>
> As seen in LOGCXX-430 and LOGCXX-322, making sure that when an application 
> terminates earlier than expected we don't crash is rather hard to do.
> I came across this solution when researching this problem:
> https://stackoverflow.com/a/470545/624483
> My thought is that we create something like a log4cxx::Globals class, which 
> contains a smart pointer to everything that must be kept alive before the 
> library can safely be unloaded.  In each thread, you would do something like:
> {{GlobalsPtr globals = log4cxx::globals;}}
> thus ensuring that the destructor can't run before all of the threads are 
> stopped.  This would be up to the user of the library.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to