Line data Source code
1 : #pragma once 2 : 3 : #include "source/common/common/c_smart_ptr.h" 4 : 5 : struct event_base; 6 : extern "C" { 7 : void event_base_free(event_base*); 8 : } 9 : 10 : struct evconnlistener; 11 : extern "C" { 12 : void evconnlistener_free(evconnlistener*); 13 : } 14 : 15 : namespace Envoy { 16 : namespace Event { 17 : namespace Libevent { 18 : 19 : /** 20 : * Global functionality specific to libevent. 21 : */ 22 : class Global { 23 : public: 24 1596 : static bool initialized() { return initialized_; } 25 : 26 : /** 27 : * Initialize the library globally. 28 : */ 29 : static void initialize(); 30 : 31 : private: 32 : // True if initialized() has been called. 33 : static bool initialized_; 34 : }; 35 : 36 : using BasePtr = CSmartPtr<event_base, event_base_free>; 37 : 38 : } // namespace Libevent 39 : } // namespace Event 40 : } // namespace Envoy