8000 Add `deinitialize()` to allow deinit without `Initializer`. · log4cplus/log4cplus@25185bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 25185bc

Browse files
committed
Add deinitialize() to allow deinit without Initializer.
Also, to make the API symetric with a counterpart of `initialize()`.
1 parent a70c1e6 commit 25185bc

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

include/log4cplus/config.hxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,15 @@ namespace log4cplus
190190
LOG4CPLUS_EXPORT void threadCleanup ();
191191

192192
//! Initializes log4cplus.
193+
//!
194+
//! \note using `log4cplus::Initializer` is preferred
193195
LOG4CPLUS_EXPORT void initialize ();
194196

197+
//! Deinitializes log4cplus.
198+
//!
199+
//! \note using `log4cplus::Initializer` is preferred
200+
LOG4CPLUS_EXPORT void deinitialize ();
201+
195202
//! Set thread pool size.
196203
LOG4CPLUS_EXPORT void setThreadPoolSize (std::size_t pool_size);
197204

src/global-init.cxx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ Initializer::~Initializer ()
112112
if (InitializerImpl::instance->count == 0)
113113
{
114114
destroy = true;
115-
shutdownThreadPool();
116-
Logger::shutdown ();
115+
deinitialize ();
117116
}
118117
}
119118
if (destroy)
@@ -499,6 +498,14 @@ initialize ()
499498
}
500499

501500

501+
void
502+
deinitialize ()
503+
{
504+
shutdownThreadPool();
505+
Logger::shutdown ();
506+
}
507+
508+
502509
void
503510
threadCleanup ()
504511
{

0 commit comments

Comments
 (0)
0