@@ -58,14 +58,19 @@ namespace ocs {
58
58
// get accounting data
59
59
rapidjson::StringBuffer json_buffer;
60
60
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
+
63
68
if (ret) {
64
69
// append data to buffer
65
70
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 );
67
72
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 );
69
74
}
70
75
71
76
DRETURN (ret);
@@ -75,9 +80,9 @@ namespace ocs {
75
80
JsonReportingFileWriter::create_record (rapidjson::StringBuffer &stringBuffer) {
76
81
stringBuffer.Put (' \n ' );
77
82
78
- sge_mutex_lock (typeid (*this ).name (), __func__, __LINE__, &mutex );
83
+ sge_mutex_lock (typeid (*this ).name (), __func__, __LINE__, &buffer_mutex );
79
84
buffer += stringBuffer.GetString ();
80
- sge_mutex_unlock (typeid (*this ).name (), __func__, __LINE__, &mutex );
85
+ sge_mutex_unlock (typeid (*this ).name (), __func__, __LINE__, &buffer_mutex );
81
86
}
82
87
83
88
bool
0 commit comments