eventcore.core 4/8(50%) line coverage

      
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
301
310
320
330
340
351
360
370
380
390
400
411
421
430
440
450
460
470
480
490
500
510
520
530
540
550
560
570
580
590
600
610
module eventcore.core; public import eventcore.driver; import eventcore.drivers.posix.select; import eventcore.drivers.posix.epoll; import eventcore.drivers.posix.kqueue; import eventcore.drivers.libasync; import eventcore.drivers.winapi.driver; version (EventcoreEpollDriver) alias NativeEventDriver = EpollEventDriver; else version (EventcoreKqueueDriver) alias NativeEventDriver = KqueueEventDriver; else version (EventcoreWinAPIDriver) alias NativeEventDriver = WinAPIEventDriver; else version (EventcoreLibasyncDriver) alias NativeEventDriver = LibasyncEventDriver; else version (EventcoreSelectDriver) alias NativeEventDriver = SelectEventDriver; else alias NativeEventDriver = EventDriver; @property NativeEventDriver eventDriver() @safe @nogc nothrow { static if (is(NativeEventDriver == EventDriver)) assert(s_driver !is null, "setupEventDriver() was not called for this thread."); else assert(s_driver !is null, "eventcore.core static constructor didn't run!?"); return s_driver; } static if (!is(NativeEventDriver == EventDriver)) { static this() { if (!s_driver) s_driver = new NativeEventDriver; } static ~this() { if (!s_isMainThread) s_driver.dispose(); } shared static this() { s_driver = new NativeEventDriver; s_isMainThread = true; } shared static ~this() { s_driver.dispose(); } } else { void setupEventDriver(EventDriver driver) { assert(driver !is null, "The event driver instance must be non-null."); assert(!s_driver, "Can only set up the event driver once per thread."); s_driver = driver; } } private { NativeEventDriver s_driver; bool s_isMainThread; }