Apache log4cxx  Version 0.12.1
aprinitializer.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _LOG4CXX_HELPERS_APRINITIALIZER_H
19 #define _LOG4CXX_HELPERS_APRINITIALIZER_H
20 
21 #ifndef LOG4CXX
22  #error "aprinitializer.h should only be included by log4cxx implementation"
23 #endif
24 
25 #include <list>
26 
27 extern "C" {
30 }
31 
32 #include <apr_time.h>
33 #include <mutex>
34 
35 namespace log4cxx
36 {
37 namespace helpers
38 {
39 class FileWatchdog;
40 
42 {
43  public:
44  static log4cxx_time_t initialize();
45  static apr_pool_t* getRootPool();
46  static apr_threadkey_t* getTlsKey();
47  static bool isDestructed;
48 
54  static void registerCleanup(FileWatchdog* watchdog);
55  static void unregisterCleanup(FileWatchdog* watchdog);
56 
57  private:
60  APRInitializer& operator=(const APRInitializer&);
61  apr_pool_t* p;
62  std::mutex mutex;
63  std::list<FileWatchdog*> watchdogs;
64  apr_time_t startTime;
65  apr_threadkey_t* tlsKey;
66  static APRInitializer& getInstance();
67 
68  public:
70 };
71 } // namespace helpers
72 } // namespace log4cxx
73 
74 #endif //_LOG4CXX_HELPERS_APRINITIALIZER_H
static log4cxx_time_t initialize()
static void unregisterCleanup(FileWatchdog *watchdog)
static bool isDestructed
Definition: aprinitializer.h:47
Check every now and then that a certain file has not changed.
Definition: filewatchdog.h:38
struct apr_threadkey_t apr_threadkey_t
Definition: aprinitializer.h:29
static apr_threadkey_t * getTlsKey()
static void registerCleanup(FileWatchdog *watchdog)
Register a FileWatchdog for deletion prior to APR termination.
Definition: aprinitializer.h:41
Definition: appender.h:32
struct apr_thread_mutex_t apr_thread_mutex_t
Definition: aprinitializer.h:28
static apr_pool_t * getRootPool()