修复销毁maat句柄(Maat_burn_feather)时没有释放FieldStat句柄的bug。

This commit is contained in:
zhengchao
2018-11-26 18:41:45 +08:00
parent eddc68eaf0
commit 8a1fe9caf2
3 changed files with 9 additions and 2 deletions

View File

@@ -813,8 +813,8 @@ int Maat_initiate_feather(Maat_feather_t feather)
maat_stat_init(_feather); maat_stat_init(_feather);
pthread_t cfg_mon_t;
pthread_create(&cfg_mon_t, NULL, thread_rule_monitor, (void*)_feather); pthread_create(&(_feather->cfg_mon_t), NULL, thread_rule_monitor, (void*)_feather);
return 0; return 0;
} }
@@ -889,6 +889,8 @@ void Maat_burn_feather(Maat_feather_t feather)
{ {
struct _Maat_feather_t* _feather=(_Maat_feather_t*)feather; struct _Maat_feather_t* _feather=(_Maat_feather_t*)feather;
_feather->still_working=0;//destroy will proceed in thread_rule_monitor _feather->still_working=0;//destroy will proceed in thread_rule_monitor
void* ret=NULL;
pthread_join(_feather->cfg_mon_t, &ret);
return; return;
} }
int Maat_table_register(Maat_feather_t feather,const char* table_name) int Maat_table_register(Maat_feather_t feather,const char* table_name)

View File

@@ -3576,6 +3576,10 @@ void *thread_rule_monitor(void *arg)
feather->redis_write_ctx=NULL; feather->redis_write_ctx=NULL;
pthread_mutex_unlock(&(feather->redis_write_lock)); pthread_mutex_unlock(&(feather->redis_write_lock));
} }
if(feather->stat_on&& feather->stat_handle)
{
FS_stop(&(feather->stat_handle));
}
free(feather); free(feather);
return NULL; return NULL;
} }

View File

@@ -415,6 +415,7 @@ struct _Maat_feather_t
char group_tn[MAX_TABLE_NAME_LEN]; char group_tn[MAX_TABLE_NAME_LEN];
pthread_mutex_t backgroud_update_mutex; pthread_mutex_t backgroud_update_mutex;
unsigned char decrypt_key[MAX_TABLE_NAME_LEN]; unsigned char decrypt_key[MAX_TABLE_NAME_LEN];
pthread_t cfg_mon_t;
char redis_ip[MAX_TABLE_NAME_LEN]; char redis_ip[MAX_TABLE_NAME_LEN];
int redis_port; int redis_port;