aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/resource_quota.h
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2018-06-11 08:54:30 -0700
committerGravatar Sree Kuchibhotla <sreek@google.com>2018-07-17 10:25:33 -0700
commit67bb4e30302cec45c9e05144a64ee6a38c0f9559 (patch)
tree45b3f0f58b5f949404c85542ab6b66ce7bd086b7 /src/core/lib/iomgr/resource_quota.h
parenta93fdfce84533eeb26461d2d457256df43dd8078 (diff)
Initial scaffolding
Diffstat (limited to 'src/core/lib/iomgr/resource_quota.h')
-rw-r--r--src/core/lib/iomgr/resource_quota.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h
index 937daf8728..a111ebb4d8 100644
--- a/src/core/lib/iomgr/resource_quota.h
+++ b/src/core/lib/iomgr/resource_quota.h
@@ -93,6 +93,22 @@ void grpc_resource_user_ref(grpc_resource_user* resource_user);
void grpc_resource_user_unref(grpc_resource_user* resource_user);
void grpc_resource_user_shutdown(grpc_resource_user* resource_user);
+/* Attempts to get quota (from the resource_user) to create 'thd_count' number
+ * of threads. Returns true if successful (i.e the caller is now free to create
+ * 'thd_count' number of threads or false if quota is not available */
+bool grpc_resource_user_alloc_threads(grpc_resource_user* resource_user,
+ int thd_count);
+/* Releases 'thd_count' worth of quota back to the resource user. The quota
+ * should have been previously obtained successfully by calling
+ * grpc_resource_user_alloc_threads().
+ *
+ * Note: There need not be an exact one-to-one correspondence between
+ * grpc_resource_user_alloc_threads() and grpc_resource_user_free_threads()
+ * calls. The only requirement is that the number of threads allocated should
+ * all be eventually released */
+void grpc_resource_user_free_threads(grpc_resource_user* resource_user,
+ int thd_count);
+
/* Allocate from the resource user (and its quota).
If optional_on_done is NULL, then allocate immediately. This may push the
quota over-limit, at which point reclamation will kick in.