Instantiate Loop::run<Mode>() in the .cpp
This is possible because a limited values are available as Mode Signed-off-by: Stefano Fiorentino <stefano.fiore84@gmail.com>
This commit is contained in:
parent
0ee7ef41fe
commit
d611ca264f
@ -65,6 +65,14 @@ UVW_INLINE void Loop::close() {
|
||||
}
|
||||
|
||||
|
||||
template<Loop::Mode mode>
|
||||
bool Loop::run() noexcept {
|
||||
auto utm = static_cast<std::underlying_type_t<Mode>>(mode);
|
||||
auto uvrm = static_cast<uv_run_mode>(utm);
|
||||
return (uv_run(loop.get(), uvrm) == 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool Loop::alive() const noexcept {
|
||||
return !(uv_loop_alive(loop.get()) == 0);
|
||||
}
|
||||
@ -130,4 +138,11 @@ UVW_INLINE uv_loop_t *Loop::raw() noexcept {
|
||||
}
|
||||
|
||||
|
||||
// explicit instantiation definitions
|
||||
|
||||
template bool Loop::run<Loop::Mode::DEFAULT>() noexcept;
|
||||
template bool Loop::run<Loop::Mode::ONCE>() noexcept;
|
||||
template bool Loop::run<Loop::Mode::NOWAIT>() noexcept;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -264,11 +264,7 @@ public:
|
||||
* @return True when done, false in all other cases.
|
||||
*/
|
||||
template<Mode mode = Mode::DEFAULT>
|
||||
bool run() noexcept {
|
||||
auto utm = static_cast<std::underlying_type_t<Mode>>(mode);
|
||||
auto uvrm = static_cast<uv_run_mode>(utm);
|
||||
return (uv_run(loop.get(), uvrm) == 0);
|
||||
}
|
||||
bool run() noexcept;
|
||||
|
||||
/**
|
||||
* @brief Checks if there are active resources.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user