1 |
|
|
#ifndef SRC_TIMER_WRAP_INL_H_ |
2 |
|
|
#define SRC_TIMER_WRAP_INL_H_ |
3 |
|
|
|
4 |
|
|
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
5 |
|
|
|
6 |
|
|
#include "timer_wrap.h" |
7 |
|
|
|
8 |
|
|
#include <utility> |
9 |
|
|
|
10 |
|
|
#include "env.h" |
11 |
|
|
#include "uv.h" |
12 |
|
|
|
13 |
|
|
namespace node { |
14 |
|
|
|
15 |
|
|
template <typename... Args> |
16 |
|
2 |
inline TimerWrap::TimerWrap(Environment* env, Args&&... args) |
17 |
|
2 |
: env_(env), fn_(std::forward<Args>(args)...) { |
18 |
|
2 |
uv_timer_init(env->event_loop(), &timer_); |
19 |
|
2 |
timer_.data = this; |
20 |
|
2 |
} |
21 |
|
|
|
22 |
|
|
template <typename... Args> |
23 |
|
2 |
inline TimerWrapHandle::TimerWrapHandle(Environment* env, Args&&... args) { |
24 |
|
2 |
timer_ = new TimerWrap(env, std::forward<Args>(args)...); |
25 |
|
2 |
env->AddCleanupHook(CleanupHook, this); |
26 |
|
2 |
} |
27 |
|
|
|
28 |
|
|
} // namespace node |
29 |
|
|
|
30 |
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
31 |
|
|
|
32 |
|
|
#endif // SRC_TIMER_WRAP_INL_H_ |