From 7e1f3eb3d6c6224dccb694375ef496704fa0fb8e Mon Sep 17 00:00:00 2001 From: zhengchao Date: Sat, 22 Jan 2022 11:36:58 +0500 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=88=90=E5=91=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entry/Maat_ex_data.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/entry/Maat_ex_data.cpp b/src/entry/Maat_ex_data.cpp index 9103a76..dd6504f 100644 --- a/src/entry/Maat_ex_data.cpp +++ b/src/entry/Maat_ex_data.cpp @@ -17,7 +17,6 @@ struct EX_data_container size_t key_len; void* user_data; - UT_hash_handle hh; UT_hash_handle hh_a, hh_b; const struct EX_data_rt* rt; @@ -31,6 +30,7 @@ struct EX_data_rt pthread_mutex_t mutex_update_commit; int is_updating; + time_t update_start_time; char effective_hash;//value 'a' or 'b', indicates which hash is effective struct EX_data_container* hash_key2ex_a, *hash_key2ex_b; //two hash for read-copy-update (RCU) @@ -160,6 +160,7 @@ void EX_data_rt_update_prepare(struct EX_data_rt* ex_rt) HASH_ADD_KEYPTR(hh_a, ex_rt->hash_key2ex_a, ex_container->key, ex_container->key_len, ex_container); } } + ex_rt->update_start_time=time(NULL); ex_rt->is_updating=1; return; } @@ -193,7 +194,11 @@ void EX_data_rt_update_commit(struct EX_data_rt* ex_rt) HASH_DELETE(hh_b, ex_rt->hash_key2ex_b, ex_container); } } - ex_rt->is_updating=0; + ex_rt->is_updating=0; + if(time(NULL)-ex_rt->update_start_time>10) + { + printf("Danger: %s cost more time than EXC garbage collection timeout.\n", __func__); + } pthread_mutex_unlock(&ex_rt->mutex_update_commit); return; }