diff --git a/src/env-inl.h b/src/env-inl.h index 63f5a941ef1..e2ab4987b24 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -126,6 +126,10 @@ inline bool Environment::AsyncListener::has_listener() const { return fields_[kHasListener] > 0; } +inline uint32_t Environment::AsyncListener::watched_providers() const { + return fields_[kWatchedProviders]; +} + inline Environment::DomainFlag::DomainFlag() { for (int i = 0; i < kFieldsCount; ++i) fields_[i] = 0; } @@ -253,6 +257,11 @@ inline bool Environment::has_async_listener() const { return const_cast(this)->async_listener()->has_listener(); } +inline uint32_t Environment::watched_providers() const { + // The const_cast is okay, it doesn't violate conceptual const-ness. + return const_cast(this)->async_listener()->watched_providers(); +} + inline bool Environment::in_domain() const { // The const_cast is okay, it doesn't violate conceptual const-ness. return using_domains() && diff --git a/src/env.h b/src/env.h index a5f09676f40..467d1d42674 100644 --- a/src/env.h +++ b/src/env.h @@ -191,6 +191,7 @@ class Environment { inline uint32_t* fields(); inline int fields_count() const; inline bool has_listener() const; + inline uint32_t watched_providers() const; private: friend class Environment; // So we can call the constructor. @@ -198,6 +199,7 @@ class Environment { enum Fields { kHasListener, + kWatchedProviders, kFieldsCount }; @@ -272,6 +274,7 @@ class Environment { inline uv_loop_t* event_loop() const; inline bool has_async_listener() const; inline bool in_domain() const; + inline uint32_t watched_providers() const; static inline Environment* from_immediate_check_handle(uv_check_t* handle); inline uv_check_t* immediate_check_handle(); diff --git a/src/node.js b/src/node.js index c2f57d6673a..7fe714e14e7 100644 --- a/src/node.js +++ b/src/node.js @@ -283,6 +283,7 @@ // Needs to be the same as src/env.h var kHasListener = 0; + var kWatchedProviders = 1; // Flags to determine what async listeners are available. var HAS_CREATE_AL = 1 << 0;