From 7b04b5bd7dc7725f083d189ecc8b2d0a6b370be6 Mon Sep 17 00:00:00 2001 From: wangyulie Date: Thu, 27 Jul 2023 17:37:18 +0800 Subject: [PATCH] update interfaces of timeout callback Signed-off-by: wangyulie --- interfaces/kits/c/queue.h | 4 ++-- interfaces/kits/cpp/queue.h | 12 ++++++------ src/queue/serial_queue_api.cpp | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/interfaces/kits/c/queue.h b/interfaces/kits/c/queue.h index ec094f0..fb1666a 100644 --- a/interfaces/kits/c/queue.h +++ b/interfaces/kits/c/queue.h @@ -27,8 +27,8 @@ FFRT_C_API void ffrt_queue_attr_set_qos(ffrt_queue_attr_t* attr, ffrt_qos_t qos) FFRT_C_API ffrt_qos_t ffrt_queue_attr_get_qos(const ffrt_queue_attr_t* attr); FFRT_C_API void ffrt_queue_attr_set_timeout(ffrt_queue_attr_t* attr, uint64_t timeout_us); FFRT_C_API uint64_t ffrt_queue_attr_get_timeout(const ffrt_queue_attr_t* attr); -FFRT_C_API void ffrt_queue_attr_set_timeoutCb(ffrt_queue_attr_t* attr, ffrt_function_header_t* f); -FFRT_C_API ffrt_function_header_t* ffrt_queue_attr_get_timeoutCb(const ffrt_queue_attr_t* attr); +FFRT_C_API void ffrt_queue_attr_set_callback(ffrt_queue_attr_t* attr, ffrt_function_header_t* f); +FFRT_C_API ffrt_function_header_t* ffrt_queue_attr_get_callback(const ffrt_queue_attr_t* attr); // create serial queue FFRT_C_API ffrt_queue_t ffrt_queue_create(ffrt_queue_type_t type, const char* name, const ffrt_queue_attr_t* attr); diff --git a/interfaces/kits/cpp/queue.h b/interfaces/kits/cpp/queue.h index 4fbc1b7..156fce9 100644 --- a/interfaces/kits/cpp/queue.h +++ b/interfaces/kits/cpp/queue.h @@ -60,17 +60,17 @@ public: return ffrt_queue_attr_get_timeout(this); } - // set timeoutCb - inline queue_attr& timeoutCb(std::function& func) + // set timeout callback + inline queue_attr& callback(std::function& func) { - ffrt_queue_attr_set_timeoutCb(this, create_function_wrapper(func, ffrt_function_kind_queue)); + ffrt_queue_attr_set_callback(this, create_function_wrapper(func, ffrt_function_kind_queue)); return *this; } - // get timeoutCb - inline ffrt_function_header_t* timeoutCb() const + // get timeout callback + inline ffrt_function_header_t* callback() const { - return ffrt_queue_attr_get_timeoutCb(this); + return ffrt_queue_attr_get_callback(this); } }; diff --git a/src/queue/serial_queue_api.cpp b/src/queue/serial_queue_api.cpp index 6f0cb80..94d6567 100644 --- a/src/queue/serial_queue_api.cpp +++ b/src/queue/serial_queue_api.cpp @@ -102,7 +102,7 @@ uint64_t ffrt_queue_attr_get_timeout(const ffrt_queue_attr_t* attr) } API_ATTRIBUTE((visibility("default"))) -void ffrt_queue_attr_set_timeoutCb(ffrt_queue_attr_t* attr, ffrt_function_header_t* f) +void ffrt_queue_attr_set_callback(ffrt_queue_attr_t* attr, ffrt_function_header_t* f) { FFRT_COND_DO_ERR((attr == nullptr), return, "input invalid, attr == nullptr"); ffrt::task_attr_private* p = reinterpret_cast(attr); @@ -114,7 +114,7 @@ void ffrt_queue_attr_set_timeoutCb(ffrt_queue_attr_t* attr, ffrt_function_header } API_ATTRIBUTE((visibility("default"))) -ffrt_function_header_t* ffrt_queue_attr_get_timeoutCb(const ffrt_queue_attr_t* attr) +ffrt_function_header_t* ffrt_queue_attr_get_callback(const ffrt_queue_attr_t* attr) { FFRT_COND_DO_ERR((attr == nullptr), return nullptr, "input invalid, attr == nullptr"); ffrt_queue_attr_t* p = const_cast(attr); @@ -129,7 +129,7 @@ ffrt_queue_t ffrt_queue_create(ffrt_queue_type_t type, const char* name, const f int qos = ffrt_queue_attr_get_qos(attr); shared_ptr looper = - make_shared(name, qos, ffrt_queue_attr_get_timeout(attr), ffrt_queue_attr_get_timeoutCb(attr)); + make_shared(name, qos, ffrt_queue_attr_get_timeout(attr), ffrt_queue_attr_get_callback(attr)); FFRT_COND_DO_ERR((looper == nullptr), return nullptr, "failed to construct SerialLooper"); SerialHandler* handler = new (std::nothrow) SerialHandler(looper);