From 6451673f379319755ff238ffef18c674ce37bd0b Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Thu, 9 May 2019 18:16:45 -0700 Subject: [PATCH] Add C bindings for LowerThreadPoolIO/CPUPriority (#5285) Summary: There were no C bindings for lowering thread pool priority. This adds those. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5285 Differential Revision: D15290050 Pulled By: siying fbshipit-source-id: b2ed94d0c39d27434ace2204829a242b53d0d67a --- db/c.cc | 16 ++++++++++++++++ include/rocksdb/c.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/db/c.cc b/db/c.cc index aac1cf408..58b51e252 100644 --- a/db/c.cc +++ b/db/c.cc @@ -3268,6 +3268,22 @@ void rocksdb_env_join_all_threads(rocksdb_env_t* env) { env->rep->WaitForJoin(); } +void rocksdb_env_lower_thread_pool_io_priority(rocksdb_env_t* env) { + env->rep->LowerThreadPoolIOPriority(); +} + +void rocksdb_env_lower_high_priority_thread_pool_io_priority(rocksdb_env_t* env) { + env->rep->LowerThreadPoolIOPriority(Env::HIGH); +} + +void rocksdb_env_lower_thread_pool_cpu_priority(rocksdb_env_t* env) { + env->rep->LowerThreadPoolCPUPriority(); +} + +void rocksdb_env_lower_high_priority_thread_pool_cpu_priority(rocksdb_env_t* env) { + env->rep->LowerThreadPoolCPUPriority(Env::HIGH); +} + void rocksdb_env_destroy(rocksdb_env_t* env) { if (!env->is_default) delete env->rep; delete env; diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index a0ae7ca77..ed0709d22 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -1301,6 +1301,11 @@ extern ROCKSDB_LIBRARY_API void rocksdb_env_set_high_priority_background_threads(rocksdb_env_t* env, int n); extern ROCKSDB_LIBRARY_API void rocksdb_env_join_all_threads( rocksdb_env_t* env); +extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_thread_pool_io_priority(rocksdb_env_t* env); +extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_high_priority_thread_pool_io_priority(rocksdb_env_t* env); +extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_thread_pool_cpu_priority(rocksdb_env_t* env); +extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_high_priority_thread_pool_cpu_priority(rocksdb_env_t* env); + extern ROCKSDB_LIBRARY_API void rocksdb_env_destroy(rocksdb_env_t*); extern ROCKSDB_LIBRARY_API rocksdb_envoptions_t* rocksdb_envoptions_create();