[89] | 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 <log4cxx/helpers/pool.h>
|
---|
| 26 | #include <apr_pools.h>
|
---|
| 27 | #include <apr_thread_proc.h>
|
---|
| 28 |
|
---|
| 29 | namespace log4cxx
|
---|
| 30 | {
|
---|
| 31 | namespace helpers
|
---|
| 32 | {
|
---|
| 33 | class APRInitializer
|
---|
| 34 | {
|
---|
| 35 | public:
|
---|
| 36 | static log4cxx_time_t initialize();
|
---|
| 37 | static apr_pool_t* getRootPool();
|
---|
| 38 | static apr_threadkey_t* getTlsKey();
|
---|
| 39 | static bool isDestructed;
|
---|
| 40 |
|
---|
| 41 | private:
|
---|
| 42 | APRInitializer();
|
---|
| 43 | APRInitializer(const APRInitializer&);
|
---|
| 44 | APRInitializer& operator=(const APRInitializer&);
|
---|
| 45 | apr_pool_t* p;
|
---|
| 46 | log4cxx_time_t startTime;
|
---|
| 47 | apr_threadkey_t* tlsKey;
|
---|
| 48 | static APRInitializer& getInstance();
|
---|
| 49 | static void tlsDestruct(void*);
|
---|
| 50 |
|
---|
| 51 | public:
|
---|
| 52 | ~APRInitializer();
|
---|
| 53 | };
|
---|
| 54 | } // namespace helpers
|
---|
| 55 | } // namespace log4cxx
|
---|
| 56 |
|
---|
| 57 | #endif //_LOG4CXX_HELPERS_APRINITIALIZER_H
|
---|