Made Xorriso_process_msg_queues() thread-safe
This commit is contained in:
@ -320,6 +320,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
}
|
||||
m->lib_msg_queue_lock_ini= 0;
|
||||
m->result_msglists_lock_ini= 0;
|
||||
m->write_to_channel_lock_ini= 0;
|
||||
m->msglist_stackfill= 0;
|
||||
m->status_history_max= Xorriso_status_history_maX;
|
||||
m->scsi_log= 0;
|
||||
@ -330,6 +331,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
Xorriso__text_to_sev(m->abort_on_text, &m->abort_on_severity, 0);
|
||||
m->abort_on_is_default= 1;
|
||||
m->problem_status= 0;
|
||||
m->problem_status_lock_ini= 0;
|
||||
m->problem_status_text[0]= 0;
|
||||
m->errfile_log[0]= 0;
|
||||
m->errfile_mode= 0;
|
||||
@ -444,6 +446,14 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
if(ret != 0)
|
||||
goto failure;
|
||||
m->result_msglists_lock_ini= 1;
|
||||
ret= pthread_mutex_init(&(m->write_to_channel_lock), NULL);
|
||||
if(ret != 0)
|
||||
goto failure;
|
||||
m->result_msglists_lock_ini= 1;
|
||||
ret= pthread_mutex_init(&(m->problem_status_lock), NULL);
|
||||
if(ret != 0)
|
||||
goto failure;
|
||||
m->problem_status_lock_ini= 1;
|
||||
|
||||
if(leafname != NULL)
|
||||
free(leafname);
|
||||
@ -524,13 +534,18 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
|
||||
for(i= 0; i < Xorriso_max_appended_partitionS; i++)
|
||||
if(m->appended_partitions[i] != NULL)
|
||||
free(m->appended_partitions[i]);
|
||||
|
||||
Xorriso_detach_libraries(m, flag&1);
|
||||
|
||||
if(m->lib_msg_queue_lock_ini)
|
||||
pthread_mutex_destroy(&(m->lib_msg_queue_lock));
|
||||
if(m->result_msglists_lock_ini)
|
||||
pthread_mutex_destroy(&(m->result_msglists_lock));
|
||||
if(m->write_to_channel_lock_ini)
|
||||
pthread_mutex_destroy(&(m->write_to_channel_lock));
|
||||
if(m->problem_status_lock_ini)
|
||||
pthread_mutex_destroy(&(m->problem_status_lock));
|
||||
|
||||
Xorriso_detach_libraries(m, flag&1);
|
||||
|
||||
free((char *) m);
|
||||
*xorriso= NULL;
|
||||
return(1);
|
||||
|
Reference in New Issue
Block a user