This file is indexed.

/usr/include/log4shib/threading/OmniThreads.hh is in liblog4shib-dev 1.0.9-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
 * OmniThreads.hh
 *
 * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
 * Copyright 2002, Bastiaan Bakker. All rights reserved.
 *
 * See the COPYING file for the terms of usage and distribution.
 */

#ifndef _LOG4SHIB_THREADING_OMNITHREADS_HH
#define _LOG4SHIB_THREADING_OMNITHREADS_HH

#include <log4shib/Portability.hh>
#include <omnithread.h>
#include <stdio.h>
#include <string>

namespace log4shib {
    namespace threading {
        /**
         * Return an identifier for the current thread. What these 
         * identifiers look like is completely up to the underlying 
         * thread library. OmniThreads returns the POSIX thread Id.
         **/
        std::string getThreadId();
        
        /**
         * A simple, non recursive Mutex.
         * Equivalent to Boost.Threads boost::mutex
         **/
        typedef omni_mutex Mutex;

        /**
         * A simple "resource acquisition is initialization" idiom type lock
         * for Mutex. 
         * Equivalent to Boost.Threads boost::scoped_lock.
         **/
        typedef omni_mutex_lock ScopedLock;

        /** 
         * This class holds Thread local data of type T, i.e. for each
         * thread a ThreadLocalDataHolder holds 0 or 1 instance of T. 
         * The held object must be heap allocated and will be deleted 
         * upon termination of the thread to wich it belongs.
         * This is an omni_threads based equivalent of Boost.Threads 
         * thread_specific_ptr<T> class.
         **/
        template<typename T> class ThreadLocalDataHolder {
            public:
            typedef T data_type;

            inline ThreadLocalDataHolder() :
                _key(omni_thread::allocate_key()) {};

            inline ~ThreadLocalDataHolder() {};
            
            /**
             * Obtains the Object held for the current thread.
             * @return a pointer to the held Object or NULL if no
             * Object has been set for the current thread.
             **/
            inline T* get() const {
                Holder* holder = dynamic_cast<Holder*>(
                    ::omni_thread::self()->get_value(_key));
                return (holder) ? holder->data : NULL;
            };

            /**
             * Obtains the Object held for the current thread. 
             * Initially each thread holds NULL.
             * @return a pointer to the held Object or NULL if no
             * Object has been set for the current thread.
             **/
            inline T* operator->() const { return get(); };

            /**
             * Obtains the Object held for the current thread.
             * @pre get() != NULL
             * @return a reference to the held Object.
             **/
            inline T& operator*() const { return *get(); };

            /**
             * Releases the Object held for the current thread.
             * @post get() == NULL
             * @return a pointer to the Object thas was held for 
             * the current thread or NULL if no Object was held.
             **/
            inline T* release() {
                T* result = NULL;
                Holder* holder = dynamic_cast<Holder*>(
                    ::omni_thread::self()->get_value(_key));
              
                if (holder) {
                    result = holder->data;
                    holder->data = NULL;
                }

                return result;
            };

            /**
             * Sets a new Object to be held for the current thread. A 
             * previously set Object will be deleted.
             * @param p the new object to hold.
             * @post get() == p
             **/
            inline void reset(T* p = NULL) {
                Holder* holder = dynamic_cast<Holder*>(
                    ::omni_thread::self()->get_value(_key));
                if (holder) {
                    if (holder->data)
                        delete holder->data;

                    holder->data = p;
                } else {
                    holder = new Holder(p);
                    ::omni_thread::self()->set_value(_key, holder);
                }
            };

            private:            
            class Holder : public omni_thread::value_t {
                public:
                Holder(data_type* data) : data(data) {};
                virtual ~Holder() { if (data) delete (data); };
                data_type* data;
                private:
                Holder(const Holder& other);
                Holder& operator=(const Holder& other);
            };

            omni_thread::key_t _key;            
        };
    }
}
#endif