aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr/fd_posix.h
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-31 13:58:24 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-31 13:58:24 -0700
commit9ae769724578d5eb5fba916eb92cc7e8e0e0854b (patch)
treef3a8974e5c5c536bc5471ed715cb5262bdbf2c93 /src/core/iomgr/fd_posix.h
parent43e613257a38df21906dabaf0ac0f8662379c9a8 (diff)
fd refcount debugging
Diffstat (limited to 'src/core/iomgr/fd_posix.h')
-rw-r--r--src/core/iomgr/fd_posix.h11
1 files changed, 11 insertions, 0 deletions
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);