• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
TimerWrap(Environment * env,Args &&...args)16 inline TimerWrap::TimerWrap(Environment* env, Args&&... args)
17     : env_(env), fn_(std::forward<Args>(args)...) {
18   uv_timer_init(env->event_loop(), &timer_);
19   timer_.data = this;
20 }
21 
22 template <typename... Args>
TimerWrapHandle(Environment * env,Args &&...args)23 inline TimerWrapHandle::TimerWrapHandle(Environment* env, Args&&... args) {
24   timer_ = new TimerWrap(env, std::forward<Args>(args)...);
25   env->AddCleanupHook(CleanupHook, this);
26 }
27 
28 }  // namespace node
29 
30 #endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
31 
32 #endif  // SRC_TIMER_WRAP_INL_H_
33