MCPcopy Create free account
hub / github.com/3rdparty/libprocess / initialize

Method initialize

src/posix/libevent/libevent.cpp:180–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178
179
180void EventLoop::initialize()
181{
182 static Once* initialized = new Once();
183
184 if (initialized->once()) {
185 return;
186 }
187
188 // We need to initialize Libevent differently depending on the
189 // operating system threading support.
190#if defined(EVTHREAD_USE_PTHREADS_IMPLEMENTED)
191 if (evthread_use_pthreads() < 0) {
192 LOG(FATAL) << "Failed to initialize, evthread_use_pthreads";
193 }
194#elif defined(EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED)
195 if (evthread_use_windows_threads() < 0) {
196 LOG(FATAL) << "Failed to initialize, evthread_use_windows_threads";
197 }
198#else
199#error "Libevent must be compiled with either pthread or Windows thread support"
200#endif
201
202 base = event_base_new();
203
204 if (base == nullptr) {
205 LOG(FATAL) << "Failed to initialize, event_base_new";
206 }
207
208 initialized->done();
209}
210
211} // namespace process {

Callers

nothing calls this directly

Calls 2

onceMethod · 0.80
doneMethod · 0.80

Tested by

no test coverage detected