@@ -58,14 +58,19 @@ namespace ocs {
5858 // get accounting data
5959 rapidjson::StringBuffer json_buffer;
6060 rapidjson::Writer<rapidjson::StringBuffer> writer (json_buffer);
61- bool ret = sge_write_rusage (nullptr , &writer, job_report, job, ja_task, category_string,
62- &usage_pattern_list, 0 , false , true );
61+
62+ // we need to protect the usage_pattern_list via the config_mutex
63+ sge_mutex_lock (config_mutex_name.c_str (), __func__, __LINE__, &config_mutex);
64+ bool ret = sge_write_rusage (nullptr , &writer, job_report, job, ja_task, category_string, &usage_pattern_list, 0 ,
65+ false , true );
66+ sge_mutex_unlock (config_mutex_name.c_str (), __func__, __LINE__, &config_mutex);
67+
6368 if (ret) {
6469 // append data to buffer
6570 json_buffer.Put (' \n ' );
66- sge_mutex_lock (typeid (*this ).name (), __func__, __LINE__, &mutex );
71+ sge_mutex_lock (typeid (*this ).name (), __func__, __LINE__, &buffer_mutex );
6772 buffer += json_buffer.GetString ();
68- sge_mutex_unlock (typeid (*this ).name (), __func__, __LINE__, &mutex );
73+ sge_mutex_unlock (typeid (*this ).name (), __func__, __LINE__, &buffer_mutex );
6974 }
7075
7176 DRETURN (ret);
@@ -75,9 +80,9 @@ namespace ocs {
7580 JsonReportingFileWriter::create_record (rapidjson::StringBuffer &stringBuffer) {
7681 stringBuffer.Put (' \n ' );
7782
78- sge_mutex_lock (typeid (*this ).name (), __func__, __LINE__, &mutex );
83+ sge_mutex_lock (typeid (*this ).name (), __func__, __LINE__, &buffer_mutex );
7984 buffer += stringBuffer.GetString ();
80- sge_mutex_unlock (typeid (*this ).name (), __func__, __LINE__, &mutex );
85+ sge_mutex_unlock (typeid (*this ).name (), __func__, __LINE__, &buffer_mutex );
8186 }
8287
8388 bool
0 commit comments