env: add watched_providers for AsyncListener
Now the second field in asyncFlags will tell if the provider is currently being watched, or listened for. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
This commit is contained in:
parent
4a9af3fecb
commit
d9e1e4c661
@ -126,6 +126,10 @@ inline bool Environment::AsyncListener::has_listener() const {
|
|||||||
return fields_[kHasListener] > 0;
|
return fields_[kHasListener] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint32_t Environment::AsyncListener::watched_providers() const {
|
||||||
|
return fields_[kWatchedProviders];
|
||||||
|
}
|
||||||
|
|
||||||
inline Environment::DomainFlag::DomainFlag() {
|
inline Environment::DomainFlag::DomainFlag() {
|
||||||
for (int i = 0; i < kFieldsCount; ++i) fields_[i] = 0;
|
for (int i = 0; i < kFieldsCount; ++i) fields_[i] = 0;
|
||||||
}
|
}
|
||||||
@ -253,6 +257,11 @@ inline bool Environment::has_async_listener() const {
|
|||||||
return const_cast<Environment*>(this)->async_listener()->has_listener();
|
return const_cast<Environment*>(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<Environment*>(this)->async_listener()->watched_providers();
|
||||||
|
}
|
||||||
|
|
||||||
inline bool Environment::in_domain() const {
|
inline bool Environment::in_domain() const {
|
||||||
// The const_cast is okay, it doesn't violate conceptual const-ness.
|
// The const_cast is okay, it doesn't violate conceptual const-ness.
|
||||||
return using_domains() &&
|
return using_domains() &&
|
||||||
|
@ -191,6 +191,7 @@ class Environment {
|
|||||||
inline uint32_t* fields();
|
inline uint32_t* fields();
|
||||||
inline int fields_count() const;
|
inline int fields_count() const;
|
||||||
inline bool has_listener() const;
|
inline bool has_listener() const;
|
||||||
|
inline uint32_t watched_providers() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Environment; // So we can call the constructor.
|
friend class Environment; // So we can call the constructor.
|
||||||
@ -198,6 +199,7 @@ class Environment {
|
|||||||
|
|
||||||
enum Fields {
|
enum Fields {
|
||||||
kHasListener,
|
kHasListener,
|
||||||
|
kWatchedProviders,
|
||||||
kFieldsCount
|
kFieldsCount
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -272,6 +274,7 @@ class Environment {
|
|||||||
inline uv_loop_t* event_loop() const;
|
inline uv_loop_t* event_loop() const;
|
||||||
inline bool has_async_listener() const;
|
inline bool has_async_listener() const;
|
||||||
inline bool in_domain() const;
|
inline bool in_domain() const;
|
||||||
|
inline uint32_t watched_providers() const;
|
||||||
|
|
||||||
static inline Environment* from_immediate_check_handle(uv_check_t* handle);
|
static inline Environment* from_immediate_check_handle(uv_check_t* handle);
|
||||||
inline uv_check_t* immediate_check_handle();
|
inline uv_check_t* immediate_check_handle();
|
||||||
|
@ -283,6 +283,7 @@
|
|||||||
|
|
||||||
// Needs to be the same as src/env.h
|
// Needs to be the same as src/env.h
|
||||||
var kHasListener = 0;
|
var kHasListener = 0;
|
||||||
|
var kWatchedProviders = 1;
|
||||||
|
|
||||||
// Flags to determine what async listeners are available.
|
// Flags to determine what async listeners are available.
|
||||||
var HAS_CREATE_AL = 1 << 0;
|
var HAS_CREATE_AL = 1 << 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user