Add uv_loop_refcount() function, debug tool.
This commit is contained in:
parent
ac218a7ed5
commit
6d9c9a533f
@ -562,6 +562,8 @@ EV_MAYBE_UNUSED ev_is_default_loop (EV_P)
|
||||
/* create and destroy alternative loops that don't handle signals */
|
||||
struct ev_loop *ev_loop_new (unsigned int flags EV_CPP (= 0));
|
||||
|
||||
int ev_loop_refcount (EV_P);
|
||||
|
||||
ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after each poll */
|
||||
|
||||
#else
|
||||
|
||||
@ -200,6 +200,9 @@ typedef struct uv_work_s uv_work_t;
|
||||
UV_EXTERN uv_loop_t* uv_loop_new(void);
|
||||
UV_EXTERN void uv_loop_delete(uv_loop_t*);
|
||||
|
||||
/* This is a debugging tool. It's NOT part of the official API. */
|
||||
UV_EXTERN int uv_loop_refcount(const uv_loop_t*);
|
||||
|
||||
|
||||
/*
|
||||
* Returns the default loop.
|
||||
|
||||
@ -175,6 +175,11 @@ void uv_loop_delete(uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
|
||||
int uv_loop_refcount(const uv_loop_t* loop) {
|
||||
return ev_loop_refcount(loop->ev);
|
||||
}
|
||||
|
||||
|
||||
uv_loop_t* uv_default_loop(void) {
|
||||
if (!default_loop_ptr) {
|
||||
default_loop_ptr = &default_loop_struct;
|
||||
|
||||
@ -1958,6 +1958,12 @@ ev_loop_new (unsigned int flags)
|
||||
|
||||
#endif /* multiplicity */
|
||||
|
||||
int
|
||||
ev_loop_refcount (EV_P)
|
||||
{
|
||||
return activecnt;
|
||||
}
|
||||
|
||||
#if EV_VERIFY
|
||||
static void noinline
|
||||
verify_watcher (EV_P_ W w)
|
||||
|
||||
@ -116,6 +116,11 @@ void uv_loop_delete(uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
|
||||
int uv_loop_refcount(const uv_loop_t* loop) {
|
||||
return loop->refs;
|
||||
}
|
||||
|
||||
|
||||
void uv_ref(uv_loop_t* loop) {
|
||||
loop->refs++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user