From 9ae769724578d5eb5fba916eb92cc7e8e0e0854b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sun, 31 May 2015 13:58:24 -0700 Subject: fd refcount debugging --- src/core/iomgr/fd_posix.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/core/iomgr/fd_posix.h') diff --git a/src/core/iomgr/fd_posix.h b/src/core/iomgr/fd_posix.h index cfc533b7f5..eb3c959cc1 100644 --- a/src/core/iomgr/fd_posix.h +++ b/src/core/iomgr/fd_posix.h @@ -161,8 +161,19 @@ void grpc_fd_become_readable(grpc_fd *fd, int allow_synchronous_callback); void grpc_fd_become_writable(grpc_fd *fd, int allow_synchronous_callback); /* Reference counting for fds */ +#define GRPC_FD_REF_COUNT_DEBUG + +#ifdef GRPC_FD_REF_COUNT_DEBUG +void grpc_fd_ref(grpc_fd *fd, const char *reason, const char *file, int line); +void grpc_fd_unref(grpc_fd *fd, const char *reason, const char *file, int line); +#define GRPC_FD_REF(fd, reason) grpc_fd_ref(fd, reason, __FILE__, __LINE__) +#define GRPC_FD_UNREF(fd, reason) grpc_fd_unref(fd, reason, __FILE__, __LINE__) +#else void grpc_fd_ref(grpc_fd *fd); void grpc_fd_unref(grpc_fd *fd); +#define GRPC_FD_REF(fd, reason) grpc_fd_ref(fd) +#define GRPC_FD_UNREF(fd, reason) grpc_fd_unref(fd) +#endif void grpc_fd_global_init(void); void grpc_fd_global_shutdown(void); -- cgit v1.2.3